pub trait ExecutorHandler: Send + Sync {
// Required method
fn execute(&self, ctx: ExecutorContext) -> HandlerOutput;
}Expand description
Trait for executor implementations to fulfill for attempt execution.
The handler is invoked for each attempt with full context including
RunId and AttemptId for traceability. Implementations must return
a typed HandlerOutput that indicates whether the attempt succeeded,
should be retried, or should be marked as a terminal failure.
§Invariants
- Handlers must not mutate attempt-counting or run-derivation accounting.
- Handlers must use the
RunIdandAttemptIdfromHandlerInputfor all logging and reporting. - Long-running work must cooperate with timeout enforcement by polling
CancellationToken::is_cancelled()at a bounded cadence.
Required Methods§
Sourcefn execute(&self, ctx: ExecutorContext) -> HandlerOutput
fn execute(&self, ctx: ExecutorContext) -> HandlerOutput
Executes the attempt with the provided context and returns the outcome.
§Arguments
ctx- The full execution context, including run/attempt identifiers, payload, metadata, and optional workflow extensions.
§Returns
A HandlerOutput that indicates the attempt outcome:
HandlerOutput::Successif execution completed successfullyHandlerOutput::RetryableFailureif execution failed but may succeed on retryHandlerOutput::TerminalFailureif execution failed permanentlyHandlerOutput::Suspendedif execution was voluntarily preempted