https://prefect.io logo
Title
p

Patrick Tan

02/09/2023, 8:06 PM
Hi, I am using python to run flow from deployment with timeout=0 (prefect.deployment.run_deployment) , I like to inspect the flow run status, what API should I use?
j

James Sopkin

02/09/2023, 8:14 PM
Hi Patrick, if you wanted to observe the flow state programmatically you could do something like this pseudocode
from prefect import get_client

deployment_run = run_deployment({params in here})
api_client = get_client()
api_client.read_flow_run(deployment_run.id).state
p

Patrick Tan

02/09/2023, 8:15 PM
Thanks, this is what I need
g

Ghassan Hallaq

02/16/2023, 3:01 PM
Perfect, thanks.
Hi @Patrick Tan, I am getting an error when trying to get the state from the object returned from read_flow_run.
j

James Sopkin

02/16/2023, 7:00 PM
what is the error you are getting?
g

Ghassan Hallaq

02/16/2023, 7:02 PM
AttributeError: 'coroutine' object has no attribute 'state'
here is what I am calling:
p

Patrick Tan

02/16/2023, 8:08 PM
May be this help