Engine
dagpipe.engine
Execution engine responsible for running pipelines and graphs.
Summary
The Engine executes Node objects and propagates immutable State instances through either a linear sequence or a directed acyclic graph (Graph). It orchestrates execution order, branching, and state propagation.
Notes
Guarantees:
1 2 | |
Classes
Engine
Execution engine responsible for running pipeline logic.
Notes
Responsibilities:
1 2 | |
Guarantees:
1 2 3 4 | |
Initialize the execution engine.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
nodes_or_graph |
Sequence[Node] | Graph
|
Pipeline definition. May be a linear sequence or a DAG. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
If input is not a Sequence[Node] or Graph, or contains invalid node types. |
Notes
Responsibilities:
1 | |
Attributes
nodes
property
Return nodes managed by this engine.
Returns:
| Type | Description |
|---|---|
tuple[Node, ...]
|
tuple[Node, ...]: Ordered sequence in linear mode or all nodes in graph mode. |
Functions
__repr__
Return the canonical string representation of the object.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Representation that uniquely identifies the object and its configuration. |
run
Execute the pipeline starting from a root State.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root |
State
|
Initial execution state. |
required |
Returns:
| Type | Description |
|---|---|
List[State]
|
list[State]: Terminal execution states produced by the pipeline. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If root is not a State instance. |
RuntimeError
|
If the engine execution mode is invalid. |
Notes
Responsibilities:
1 | |