<@ULVA73B9P> Show me how to get the status a prefe...
# ask-marvin
i
@Marvin Show me how to get the status a prefect flow run?
m
To get the status of a Prefect flow run, you can utilize the
read_flow_run
method from the Prefect client. This method retrieves the flow run details, including its current state. Here's a concise example:
Copy code
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.