Jackson Nguyen
02/25/2025, 8:23 PMMarvin
02/25/2025, 8:23 PMprefect.runtime
module, which includes submodules for different runtime concepts like flow_run
, task_run
, and deployment
. Each of these submodules provides access to information about the current run context.
To obtain the flow-run context of a sub-flow from the parent flow, you can use the prefect.context.get_run_context()
function. This function gives you access to the current run context, which you can use to gather details about the flow run. However, it's important to note that this function raises an exception if no run context is available.
For more detailed information, you can refer to the Prefect runtime context documentation.
If you are running into issues where you need to cancel a nested flow run independently, it's recommended to deploy the sub-flow separately and start it using the run_deployment
method.
For further exploration of Prefect's API, you can review the top-level offerings, including the flow
, task
, and other modules.
Here are some additional notes on common 3.x gotchas:
- Prefect 3.x has replaced agents with workers and infrastructure blocks with work pools.
- The Deployment.build_from_flow()
method is removed; you should use some_flow.from_source(...).deploy(...)
instead.
I hope this sheds some light on the situation. If you need further assistance, don't hesitate to ask.