Pooyan
11/12/2023, 9:49 PMSequentialTaskRunner
within the flow context for these tasks to be run one after the other?Marvin
11/12/2023, 9:49 PMSequentialTaskRunner
to run tasks sequentially. The SequentialTaskRunner
is used to force tasks to run sequentially rather than concurrently, which can be useful in certain scenarios to make it easier to reason about the behavior of your program. It works with both synchronous and asynchronous task functions.
However, if you have a flow that runs a task in a for loop each time with a different set of parameters, you can manage the sequence of task execution within the flow itself. In Prefect, you can call tasks or subflows to do work within your workflow, including passing results from other tasks to your subflow. This allows you to control the order of task execution.
So, whether you need to use SequentialTaskRunner
or not depends on your specific use case and how you have structured your flow. If you want to ensure that tasks are run one after the other and not concurrently, then SequentialTaskRunner
can be a good option. Otherwise, you can manage the sequence of tasks within the flow itself.
For more detailed information, you can refer to the Prefect documentation on Task Runners and Flows.