https://prefect.io logo
p

Philip MacMenamin

10/28/2020, 5:16 PM
is there an easy way to look up the current flow ID from within a flow?
j

josh

10/28/2020, 5:19 PM
Hi @Philip MacMenamin you should be able to get the flow’s ID from context:
Copy code
...inside task...
from prefect import context
print(context.get("flow_id"))
p

Philip MacMenamin

10/28/2020, 5:26 PM
thanks Josh - sorry - I meant I need to look up the run id
j

josh

10/28/2020, 5:26 PM
context.get("flow_run_id")
should do the trick
✔️ 1
List of available context variables https://docs.prefect.io/api/latest/utilities/context.html 🙂
p

Philip MacMenamin

10/28/2020, 5:27 PM
yup, it does.
And... yes, that answers my next question. For some reason I couldn't find the appropriate docs
c

Chris White

10/28/2020, 6:14 PM
@Marvin archive “How to access flow and flow run ID from within a Flow?”