Sam P.
07/23/2024, 6:05 PMMarvin
07/23/2024, 6:05 PMSam P.
07/23/2024, 6:06 PMMarvin
07/23/2024, 6:06 PMpython
from prefect.client.orion import get_client
from prefect.orion.schemas.core import FlowRun
async def get_work_queue_from_flow_run(flow_run_id):
async with get_client() as client:
flow_run = await client.read_flow_run(flow_run_id)
deployment = await client.read_deployment(flow_run.deployment_id)
work_queue_name = deployment.work_queue_name
return work_queue_name
# Example usage:
# import asyncio
# asyncio.run(get_work_queue_from_flow_run("<YOUR_FLOW_RUN_ID"))
In this script, you replace "<YOUR_FLOW_RUN_ID>"
with the ID of your flow run. This will fetch the work queue name associated with the deployment of the flow run.
For more details, you can refer to the Prefect documentation on using the client.
Here are some relevant code examples:
- Basic usage of `@flow`: https://raw.githubusercontent.com/zzstoatzz/prefect-code-examples/main/examples/flows/basic.pySam P.
07/23/2024, 6:06 PM