ParallelExecutor

Struct ParallelExecutor 

Source
pub struct ParallelExecutor;
Expand description

Executes parallel steps by running multiple steps concurrently

Implementations§

Source§

impl ParallelExecutor

Source

pub fn execute_parallel_step( workflow: &Workflow, state: &mut WorkflowState, step_id: &str, parallel_step: &ParallelStep, ) -> WorkflowResult<()>

Execute a parallel step

Executes multiple steps concurrently, respecting the max_concurrency limit. Waits for all parallel steps to complete before returning.

§Arguments
  • workflow - The workflow containing the step
  • state - The current workflow state
  • step_id - The ID of the parallel step to execute
  • parallel_step - The parallel step configuration
§Returns

Returns Ok(()) if all parallel steps executed successfully, or an error if any step failed.

Source

pub fn execute_parallel_step_with_limit( workflow: &Workflow, state: &mut WorkflowState, step_id: &str, parallel_step: &ParallelStep, max_concurrency: usize, ) -> WorkflowResult<()>

Execute parallel steps with a concurrency limit

Executes multiple steps concurrently, limiting the number of concurrent executions to the specified max_concurrency value.

§Arguments
  • workflow - The workflow containing the step
  • state - The current workflow state
  • step_id - The ID of the parallel step to execute
  • parallel_step - The parallel step configuration
  • max_concurrency - The maximum number of concurrent executions
§Returns

Returns Ok(()) if all parallel steps executed successfully, or an error if any step failed.

Source

pub fn get_parallel_steps(parallel_step: &ParallelStep) -> &[String]

Get the steps to execute in parallel

Source

pub fn get_max_concurrency(parallel_step: &ParallelStep) -> usize

Get the max concurrency from a parallel step

Source

pub fn validate_parallel_step( parallel_step: &ParallelStep, ) -> WorkflowResult<()>

Validate a parallel step

Checks that the parallel step is valid:

  • Has at least one step to execute
  • max_concurrency is greater than 0

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.