Hi prefectionists! I’m wanting to use a link to a ...
# ask-community
b
Hi prefectionists! I’m wanting to use a link to a flow run that I’m running in prefect cloud as metadata of sorts, so I can trace long-running queries back to the flow run easily. Are there env vars populated automatically (e.g. FLOW_RUN_ID, FLOW_ID, etc) that would allow me to construct this link, or more generally, is there any way for a task to automatically get info about it’s own identity?
k
Hi @brian, you would get it from context during run time.
Copy code
@task
def make_link():
    flow_id = prefect.context.get("flow_id")
    flow_run_id = prefect.context.get("flow_run_id")
Available things can be found here
👍 1
b
Thanks!