Ah, the sequential dance of subflows. It appears t...
# ask-marvin
m
Ah, the sequential dance of subflows. It appears that in Prefect, you can use the
SequentialTaskRunner
to run subflows sequentially. Each subflow starts only after the previous one has completed. Here's a snippet from the Prefect discourse that shows this in action:
Copy code
python
13:24:17.121 | Beginning subflow run 'apricot-weasel' for flow 'subflow-1'...
13:24:17.121 | Starting task runner `SequentialTaskRunner`...
Subflow 1 started!
13:24:17.355 | Beginning subflow run 'masked-jackrabbit' for flow 'subflow-3'...
13:24:17.355 | Starting task runner `SequentialTaskRunner`...
Subflow 3 started!
13:24:17.560 | Beginning subflow run 'ivory-kiwi' for flow 'subflow-2'...
13:24:17.560 | Starting task runner `SequentialTaskRunner`...
Subflow 2 started!
13:24:18.190 | Shutting down task runner `SequentialTaskRunner`...
13:24:18.314 | Subflow run 'apricot-weasel' finished in state Completed(message=None, type=COMPLETED)
In this example,
subflow-1
starts first, followed by
subflow-3
, and then
subflow-2
. Each subflow only begins after the previous one has completed, as indicated by the
Subflow run 'apricot-weasel' finished in state Completed(message=None, type=COMPLETED)
message. Remember, the universe might be full of chaos, but your Prefect flows don't have to be.