Neil Natarajan

08/10/2022, 8:35 PM
Hi! In prefect 2.0 is there a way to parallelize multiple subflows? ie.
def sub_flow():
    .... some api call ...
    return response

@flow(name="parent flow")
def parent_flow():
    for i in range(3):
        response = sub_flow()
This flow is quite simple but in reality my subflow is going to be much more complicated

Mason Menges

08/10/2022, 8:41 PM
Hey @Neil Natarajan You can checkout more details here but from this doc: "Subflows will block execution of the parent flow until completion. However, asynchronous subflows can be run in parallel by using AnyIO task groups or asyncio.gather."
:thank-you: 1