Hi, I am using python to run flow from deployment ...
# ask-community
p
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
Hi Patrick, if you wanted to observe the flow state programmatically you could do something like this pseudocode
Copy code
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
Thanks, this is what I need
g
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
what is the error you are getting?
g
AttributeError: 'coroutine' object has no attribute 'state'
here is what I am calling:
p
May be this help