Isaac
02/07/2025, 8:03 AMMarvin
02/07/2025, 8:03 AMread_flow_run
method from the Prefect client. This method retrieves the flow run details, including its current state. Here's a concise example:
python
from prefect import get_client
async def get_flow_run_status(flow_run_id):
async with get_client() as client:
flow_run = await client.read_flow_run(flow_run_id)
return flow_run.state.name
# Example usage
# status = await get_flow_run_status("your-flow-run-id")
# print(status)
This code snippet demonstrates how to fetch and print the status of a specific flow run using its ID. The get_client
function is part of Prefect's top-level API, which provides access to the Prefect client for interacting with flow runs.
For further details, you can refer to the Prefect GitHub source code here.