executors
Chain executors.
Production workers are their own executors: their orchestration loops report progress into a
ChainExecutionContext (typically via advance_for_progress) and consult ready_nodes for routing. The
LocalChainExecutor here is the reference implementation for simple consumers and tests: a synchronous
topological walk with a pluggable work callable.
StageWorkCallable
module-attribute
Performs a stage's work and returns the generation progress it reached.
Returning the stage's completion_progress marks the stage completed; returning a failing progress fails it.
ChainExecutor
Bases: Protocol
Anything that can traverse a chain flow and produce a finished execution context.
Source code in horde_sdk/worker/chaining/executors.py
execute
Traverse the flow, performing each stage's work.
Parameters:
-
flow(ChainFlow) –The flow to traverse.
-
work(StageWorkCallable) –The callable that performs a stage's work.
Returns:
-
ChainExecutionContext(ChainExecutionContext) –The finished execution context.
Source code in horde_sdk/worker/chaining/executors.py
LocalChainExecutor
A synchronous, single-threaded reference executor.
Source code in horde_sdk/worker/chaining/executors.py
execute
Walk the flow in topological order, performing each stage's work.
A stage whose work returns a progress other than its completion progress is treated as failed, which skips all downstream stages. Stages skipped by an earlier failure are not executed.
Parameters:
-
flow(ChainFlow) –The flow to traverse.
-
work(StageWorkCallable) –The callable that performs a stage's work.
Returns:
-
ChainExecutionContext(ChainExecutionContext) –The finished execution context.