Execution¶
-
class laminar.components.Execution(id: str | NoneType, flow: 'Flow', retry: bool =
False
)¶ Bases:
object
Methods
Execute a single layer of the flow.
Get a registered flow layer.
Chain multiple flow executions together.
Configure parameters for a flow execution
Resume a flow execution from where it failed.
Schedule layers to run in sequence in the flow execution.
Attributes
Flow execution is finished.
True if the flow execution is being retried, else False.
Flow execution is currently running.
ID of the flow execution
Flow being executed
- execute(*, layer: Layer) Execution ¶
Execute a single layer of the flow.
Usage:
class ExecutionFlow(Flow): ... @ExecutionFlow.register class A(Layer): ... flow = ExecutionFlow() flow.execution(...).execute(layer=flow.layer(A, index=0, splits=2))
- property finished : bool¶
Flow execution is finished.
- id : str | None¶
ID of the flow execution
- layer(layer: str, **atributes: Any) Layer ¶
- layer(layer: type[LayerT], **attributes: Any) LayerT
- layer(layer: LayerT, **attributes: Any) LayerT
Get a registered flow layer.
Usage:
flow.execution(...).layer("A") flow.execution(...).layer(A) flow.execution(...).layer(A()) flow.execution(...).layer(A(), index=0, splits=2)
- next(*, flow: Flow, linker: Callable[[Execution], Parameters]) Execution ¶
Chain multiple flow executions together.
Usage:
class Flow1(Flow): ... class Flow2(Flow): ... @Flow1.register class A(Layer): foo: str flow1 = Flow1() flow_1().next( flow=Flow2(), linker=lambda execution: Parameters(foo=execution.layer(A).foo) )
- parameters(**artifacts: Any) Execution ¶
Configure parameters for a flow execution
Usage:
flow.execution(...).parameters(foo="bar")
- resume() Execution ¶
Resume a flow execution from where it failed.
Notes
Resuming a flow execution will skip all layers that finished on the previous attempt.
Usage:
flow.execution(...).resume()
-
retry : bool =
False
¶ True if the flow execution is being retried, else False.
- property running : bool¶
Flow execution is currently running.
- schedule(*, dependencies: dict[str, set[str]]) Execution ¶
Schedule layers to run in sequence in the flow execution.