Skip to main content

Static Parallel Steps

Start a fixed set of distinct Step types concurrently.

Definition graph

StaticParallelStepsFlow

Valid

python · examples/python/dex_examples/patterns/parallel/static_parallel_steps_flow.py

InitStep returns one movement for WorkAStep and one for WorkBStep. Both are scheduled at the same time and complete independently. Use this shape when each branch has a known responsibility and input type.

Core implementation

The starting Step returns both movements in one decision.

class WorkAStep(Step[str]):
def execute(self, context: Context, input: str) -> StepDecision:
return graceful_complete(f"A:{input}")


class WorkBStep(Step[str]):
def execute(self, context: Context, input: str) -> StepDecision:
return graceful_complete(f"B:{input}")


class InitStep(Step[str]):
def execute(self, context: Context, input: str) -> StepDecision:
return go_to_many(
StepMovement.of(WorkAStep, input),
StepMovement.of(WorkBStep, input),
)

Example: examples/python/dex_examples/patterns/parallel/static_parallel_steps_flow.py