pub struct ParallelWorker { /* private fields */ }Expand description
Runs a wrapped node once per item of a list input.
Implementations§
Source§impl ParallelWorker
impl ParallelWorker
Sourcepub fn new(
name: &str,
wrapped: Arc<dyn Node>,
max_concurrency: usize,
cfg: NodeConfig,
) -> Result<Arc<ParallelWorker>, WorkflowError>
pub fn new( name: &str, wrapped: Arc<dyn Node>, max_concurrency: usize, cfg: NodeConfig, ) -> Result<Arc<ParallelWorker>, WorkflowError>
Wraps wrapped. The wrapped node may not carry its own RetryConfig; the worker’s own
RetryConfig is taken out of cfg (hidden from the scheduler) and applied per item.
Trait Implementations§
Source§impl Node for ParallelWorker
impl Node for ParallelWorker
Source§fn run(&self, ctx: Context, input: Value) -> EventStream
fn run(&self, ctx: Context, input: Value) -> EventStream
Runs the wrapped node once per list item (at most
max_concurrency at a time; 0 = unlimited), each item under its own sub-branch
<wrapped>@<i+1> and retried independently under the worker’s RetryConfig. The first
non-retryable failure cancels the in-flight siblings and is the node’s error; otherwise one
event carries the per-index outputs. Intermediate wrapped events are suppressed. Each item
task runs on a fresh fiber spawned with PARALLEL_WORKER_CREATOR (its retries stay on
it). Dropping the stream drops the JoinSet, aborting the workers; the engine never drops
it mid-await (the scheduler drains its node tasks), so only a direct user of the stream
sees the abort.
Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§fn config(&self) -> &NodeConfig
fn config(&self) -> &NodeConfig
Source§fn input_schema(&self) -> Option<&Value>
fn input_schema(&self) -> Option<&Value>
None = no schema, no input validation.Source§fn output_schema(&self) -> Option<&Value>
fn output_schema(&self) -> Option<&Value>
None = no schema, no output validation.Source§fn validate_input(&self, v: Value) -> Result<Value, WorkflowError>
fn validate_input(&self, v: Value) -> Result<Value, WorkflowError>
run on every activation.Source§fn validate_output(&self, v: Value) -> Result<Value, WorkflowError>
fn validate_output(&self, v: Value) -> Result<Value, WorkflowError>
Source§fn state_field_names(&self) -> Option<&[String]>
fn state_field_names(&self) -> Option<&[String]>
None = node does not bind
state params.