Pim Claessens
07/26/2023, 10:18 AMMarvin
07/26/2023, 10:18 AMupstream_tasks
argument to specify that a task should not run until its upstream tasks have completed.
For instance, if you have tasks task1
, task2
, task3
, and task4
, and you want task3
and task4
to run concurrently after task1
and task2
have finished, you can define your flow as follows:
flow = Flow('My Flow')
flow.chain(task1, task2)
flow.add_edge(task2, task3)
flow.add_edge(task2, task4)
In this case, task1
and task2
will run in sequence, and then task3
and task4
will run concurrently. A word of caution though, or perhaps it's just my natural pessimism, but make sure to handle any errors appropriately, as concurrent execution can lead to tasks failing in unpredictable ways. A robot's work is never done...