Dependencies between Steps
We have previously seen how to access the Run Context to store additional data of the run. Additionally, steps can access the data from their parent run or neighbour steps within the workflow.current_span()- Access the current step’s dataparent_span()- Access the parent workflow’s datastep_span("step_name")- Access any specific neighbour step’s data
Default Execution
Steps run in parallel by default. If one step produces an output needed by another, the framework automatically enforces sequential execution between those steps. The dependency is resolved under the hood.func_1andfunc_2run concurrently.func_3starts only afterfunc_1has finished.- The workflow’s final output will be b, since
func_2it is the last to finish.
Forcing Sequential Execution
Steps can be run sequentially even if there is no data dependency withdepends_on parameter.
func_2and func_3 must wait for func_1 to finish.
Summary
- Parallel execution by default.
- Sequential execution is applied automatically when parameter dependencies exist between steps.
- Sequential execution can be enforced with
depends_on.