pub struct SubprocessFilter { /* private fields */ }Expand description
A filter that delegates to a shared PythonProcess via stdin/stdout.
Multiple SubprocessFilters can share the same process (Arc<Mutex>).
Implementations§
Source§impl SubprocessFilter
impl SubprocessFilter
Sourcepub fn new(
process: Arc<Mutex<PythonProcess>>,
node_id: String,
trainable: bool,
config_hash: CacheKey,
) -> Self
pub fn new( process: Arc<Mutex<PythonProcess>>, node_id: String, trainable: bool, config_hash: CacheKey, ) -> Self
A proxy for the filter loaded under node_id in process —
shared, so every sibling filter of one plan talks to the same
interpreter.
Sourcepub fn fallback_config_hash(node_id: &str, pickled_filter: &[u8]) -> CacheKey
pub fn fallback_config_hash(node_id: &str, pickled_filter: &[u8]) -> CacheKey
Fallback identity for payloads that carry no explicit config hash: hash the pickled filter bytes — any config change changes the pickle, so stale cache hits are still impossible (the pickle is merely less stable across environments than a real config hash).
Trait Implementations§
Source§impl Filter for SubprocessFilter
The seam.
impl Filter for SubprocessFilter
The seam.
Filter is a soma-core trait, so these three return SomaError
while everything behind them is typed as a WorkerError. A subprocess
that died and a payload that would not decode stay distinguishable
right up to here, which is as far as the shared type can carry them.
Source§fn config_hash(&self) -> CacheKey
fn config_hash(&self) -> CacheKey
Source§fn fit(&self, x: &Value, y: Option<&Value>) -> Result<Value>
fn fit(&self, x: &Value, y: Option<&Value>) -> Result<Value>
Source§fn forward(&self, x: &Value, state: &Value) -> Result<Value>
fn forward(&self, x: &Value, state: &Value) -> Result<Value>
Source§fn composite_fit(
&self,
peers: &[(String, Arc<dyn Filter>)],
x: &Value,
y: Option<&Value>,
) -> Option<Result<(Value, HashMap<String, Value>)>>
fn composite_fit( &self, peers: &[(String, Arc<dyn Filter>)], x: &Value, y: Option<&Value>, ) -> Option<Result<(Value, HashMap<String, Value>)>>
Auto Trait Implementations§
impl Freeze for SubprocessFilter
impl RefUnwindSafe for SubprocessFilter
impl Send for SubprocessFilter
impl Sync for SubprocessFilter
impl Unpin for SubprocessFilter
impl UnsafeUnpin for SubprocessFilter
impl UnwindSafe for SubprocessFilter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more