Mitch
04/23/2024, 6:07 PMMarvin
04/23/2024, 6:08 PMrun_deployment
command, by calling it with timeout=0
. This makes the runs non-blocking. To wait for these runs to complete and collect their results, you can use 'async' and 'await' in Prefect 2.x. You may submit each flow run and then await the completion of their states. Once all the flows are complete, you can aggregate their results.
For specific examples of running asynchronous tasks and dealing with the results, you can refer to the documentation on upstream dependencies where .submit()
is used to run tasks asynchronously and wait_for
keyword is used to orchestrate the dependencies effectively: Specifying Upstream Dependencies.
Additionally, the documentation on handling results asynchronously, with the example using await state.result(fetch=True)
to fetch the results of async tasks, might be particularly useful: Working with Flow and Task Results.
Although you asked about run_deployment
, the provided documentation links do not directly refer to it in the context of asynchronous execution. For a thorough example related to run_deployment
and handling multiple flows asynchronously, it might be necessary to search further in the documentation or GitHub issues.
For more detailed instructions, examining the documentation or concrete code samples would be beneficial. If you require additional information, please let me know, and I'll continue to search for more relevant examples or guidance.Mitch
04/23/2024, 6:10 PMrun_deployment("flow/deployment", timeout=0)
when they return a FlowRun object immediatelyNate
04/23/2024, 6:13 PMtimeout=0
since that's how you avoid waiting for themNate
04/23/2024, 6:13 PMawait asyncio.gather(*[run_deployment(...) for _ in whatever])
Mitch
04/23/2024, 6:20 PM