pub struct ParallelSteps {
pub name: String,
pub steps: Vec<WorkflowStep>,
pub fail_fast: bool,
}Expand description
A named group of steps that execute concurrently.
Fields§
§name: StringGroup name (for logging and error messages).
steps: Vec<WorkflowStep>The steps in this group.
fail_fast: boolWhen true (the default): return an error as soon as the first
failure is detected rather than waiting for all steps to finish.
Note: because this implementation uses std::thread::scope, all
spawned threads must complete before the scope returns regardless
of fail_fast. The flag controls only whether the error type
returned is ParallelStepError::StepFailed (single, fail-fast)
or ParallelStepError::MultipleStepsFailed (aggregated).
Implementations§
Source§impl ParallelSteps
impl ParallelSteps
Sourcepub fn new(name: impl Into<String>) -> Self
pub fn new(name: impl Into<String>) -> Self
Create a new group with fail_fast = true and no steps.
Sourcepub fn with_fail_fast(self, fail_fast: bool) -> Self
pub fn with_fail_fast(self, fail_fast: bool) -> Self
Set the fail_fast flag.
Sourcepub fn add_step(&mut self, step: WorkflowStep) -> &mut Self
pub fn add_step(&mut self, step: WorkflowStep) -> &mut Self
Append a step to the group.
Sourcepub fn execute_parallel(&self) -> Result<Vec<StepResult>, ParallelStepError>
pub fn execute_parallel(&self) -> Result<Vec<StepResult>, ParallelStepError>
Execute all steps in parallel using std::thread::scope.
All worker threads are joined before this function returns.
Results are collected in the same order as Self::steps.
§Errors
Returns ParallelStepError::StepFailed if fail_fast = true and
one or more steps fail, or ParallelStepError::MultipleStepsFailed
if fail_fast = false and multiple steps fail.