pub struct StepExecutor;Expand description
Orchestrates step execution within workflows
Handles:
- Executing steps in dependency order
- Managing step context and results
- Handling step dependencies and waiting
Implementations§
Source§impl StepExecutor
impl StepExecutor
Sourcepub fn execute_step(
workflow: &Workflow,
state: &mut WorkflowState,
step_id: &str,
) -> WorkflowResult<()>
pub fn execute_step( workflow: &Workflow, state: &mut WorkflowState, step_id: &str, ) -> WorkflowResult<()>
Execute a single step
Marks the step as running, executes it, and records the result. Dispatches to the appropriate step type handler (agent, command, condition, parallel, approval).
Sourcepub fn execute_workflow(
workflow: &Workflow,
state: &mut WorkflowState,
) -> WorkflowResult<()>
pub fn execute_workflow( workflow: &Workflow, state: &mut WorkflowState, ) -> WorkflowResult<()>
Execute steps in dependency order
Executes all steps in the workflow, respecting dependencies. Stops on first error unless error handling specifies otherwise.
Sourcepub fn execute_next_step(
workflow: &Workflow,
state: &mut WorkflowState,
) -> WorkflowResult<Option<String>>
pub fn execute_next_step( workflow: &Workflow, state: &mut WorkflowState, ) -> WorkflowResult<Option<String>>
Execute the next available step
Finds and executes the next step that is ready to run. Returns the ID of the executed step, or None if no steps are ready.
Sourcepub fn get_step_context(
workflow: &Workflow,
state: &WorkflowState,
step_id: &str,
) -> WorkflowResult<Value>
pub fn get_step_context( workflow: &Workflow, state: &WorkflowState, step_id: &str, ) -> WorkflowResult<Value>
Get step context for execution
Builds the context needed to execute a step, including:
- Step configuration
- Results from dependent steps
- Workflow parameters
Sourcepub fn fail_step(
state: &mut WorkflowState,
step_id: &str,
error: String,
) -> WorkflowResult<()>
pub fn fail_step( state: &mut WorkflowState, step_id: &str, error: String, ) -> WorkflowResult<()>
Mark a step as failed with error details
Sourcepub fn skip_step(state: &mut WorkflowState, step_id: &str) -> WorkflowResult<()>
pub fn skip_step(state: &mut WorkflowState, step_id: &str) -> WorkflowResult<()>
Mark a step as skipped
Sourcepub fn get_step_status(
state: &WorkflowState,
step_id: &str,
) -> Option<StepStatus>
pub fn get_step_status( state: &WorkflowState, step_id: &str, ) -> Option<StepStatus>
Get the status of a step
Sourcepub fn is_step_completed(state: &WorkflowState, step_id: &str) -> bool
pub fn is_step_completed(state: &WorkflowState, step_id: &str) -> bool
Check if a step has completed successfully
Sourcepub fn is_step_failed(state: &WorkflowState, step_id: &str) -> bool
pub fn is_step_failed(state: &WorkflowState, step_id: &str) -> bool
Check if a step has failed
Sourcepub fn get_step_result(
state: &WorkflowState,
step_id: &str,
) -> Option<StepResult>
pub fn get_step_result( state: &WorkflowState, step_id: &str, ) -> Option<StepResult>
Get step result
Sourcepub fn execute_condition_step(
workflow: &Workflow,
state: &mut WorkflowState,
step_id: &str,
) -> WorkflowResult<Vec<String>>
pub fn execute_condition_step( workflow: &Workflow, state: &mut WorkflowState, step_id: &str, ) -> WorkflowResult<Vec<String>>
Execute a condition step and return the next steps to execute
Evaluates the condition and returns the list of step IDs that should be executed based on the condition result (then_steps or else_steps).
Sourcepub fn get_condition_next_steps(
workflow: &Workflow,
state: &WorkflowState,
step_id: &str,
) -> WorkflowResult<Vec<String>>
pub fn get_condition_next_steps( workflow: &Workflow, state: &WorkflowState, step_id: &str, ) -> WorkflowResult<Vec<String>>
Get the next steps to execute after a condition step
Returns the list of step IDs that should be executed based on the condition result.
Sourcepub fn requires_approval(
workflow: &Workflow,
step_id: &str,
) -> WorkflowResult<bool>
pub fn requires_approval( workflow: &Workflow, step_id: &str, ) -> WorkflowResult<bool>
Check if a step requires approval
Returns true if the step has approval_required set to true.
Sourcepub fn request_step_approval(
approval_gate: &mut ApprovalGate,
workflow: &Workflow,
step_id: &str,
) -> WorkflowResult<String>
pub fn request_step_approval( approval_gate: &mut ApprovalGate, workflow: &Workflow, step_id: &str, ) -> WorkflowResult<String>
Request approval for a step
Creates an approval request for the step. The step will not execute until the approval is granted.
Sourcepub fn is_step_approved(
approval_gate: &ApprovalGate,
request_id: &str,
) -> WorkflowResult<bool>
pub fn is_step_approved( approval_gate: &ApprovalGate, request_id: &str, ) -> WorkflowResult<bool>
Check if a step has been approved
Returns true if the approval request has been approved. Returns error if the request is not found or timed out.
Sourcepub fn is_step_rejected(
approval_gate: &ApprovalGate,
request_id: &str,
) -> WorkflowResult<bool>
pub fn is_step_rejected( approval_gate: &ApprovalGate, request_id: &str, ) -> WorkflowResult<bool>
Check if a step has been rejected
Returns true if the approval request has been rejected. Returns error if the request is not found or timed out.
Sourcepub fn is_approval_pending(
approval_gate: &ApprovalGate,
request_id: &str,
) -> WorkflowResult<bool>
pub fn is_approval_pending( approval_gate: &ApprovalGate, request_id: &str, ) -> WorkflowResult<bool>
Check if approval is still pending
Returns true if the approval request is still pending.