Is there a way to get the status of the flow which...
# prefect-community
s
Is there a way to get the status of the flow which is already created and scheduled ( if the flow is already running or not running ) without using run_id in python3 ? (use like flow name instead) we use prefect cloud and using the python script in prefect agent.
a
Interesting, can you explain a bit more of what do you specifically try to do? The status of all flows and flow runs can be inspected even directly from the CLI:
Copy code
prefect get flows
prefect get flow-runs
To get more info about a specific flow run from python code (but as you noticed, you need the flow run ID but you can also get it from
prefect.context.get("flow_run_id")
):
Copy code
from prefect.backend import FlowRunView

flow_run = FlowRunView.from_flow_run_id("4c0101af-c6bb-4b96-8661-63a5bbfb5596")
https://docs.prefect.io/orchestration/flow-runs/inspection.html#creating-a-flowrunview
d
Hey, sorry for “hijacking” this thread - but I have the same problem. I have a flow that is triggering a set of other flows - the last flow is training an ML model for a couple of hours. So if the training is in progress (I think this case is a good example) I want to wait and not invoke the full pipeline until this specific flow (that I know only by name) will change state from running to finished. Any idea of how to do this by name? @Anna Geller tagging you to make sure you see the sub comment, Thanks.