Can Subflows run concurrently? #22449
Replies: 2 comments 1 reply
|
hi @EDigioacchinoTBL - to run flows concurrently, just write async python. some people wrap flows in tasks to get .submit/.map but in my opinion there's no strong reason to do that and it just creates extra wrapping import asyncio
from prefect import flow
@flow
async def single_flow():
print("doing some stuff")
@flow
async def a_different_flow():
print("doing some different stuff")
@flow
async def parent_flow():
await asyncio.gather(*[single_flow(), single_flow(), a_different_flow()])
if __name__ == "__main__":
asyncio.run(parent_flow()) |
|
@EDigioacchinoTBL — you don't need to wrap Pattern: async orchestrator flow +
|
Uh oh!
There was an error while loading. Please reload this page.
I've patterned a subflow for my use-case which batches out according to some CDC rules generating the tasks to be operated on. I'd like to reuse this component for ETL, and would also like to have multiple subflows operate concurrently from a common parent.
The documentation covers Task concurrency at length, but not Subflows.
All reactions