Hi team, I am a bit confused because I cannot mana...
# ask-community
a
Hi team, I am a bit confused because I cannot manage to retrieve the current state of a flow. I am using prefect 2 sdk in python. I built a fastapi endpoint that triggers a flow and then wait for the results to perform some tasks. The triggering of the flow works fine so I dont think its a credential issue. However when I try to retrieve the state of the flow, I get prefect.exceptions.ObjectNotFound error. This is the code i am using:
Copy code
async with get_client() as client:
        flow_run = await client.read_flow_run(flow_run_id)
        print(flow_run.state.message)
        return flow_run.state.is_completed(), flow_run.state.message
        response = await client.hello()
        return response.json()
Do you have any idea why it cannot mannage to find this flow? Thanks! Arthur
Also, if I try calling the hello method, I do get the
Copy code
"👋"
answer