How can I get the “flow id” (not the “flow run id”) from Prefect using Python from within a “task?” The task is being executed by a flow. I’m using Prefect version 2.19.1 and Python version 3.11.4.
I’ve tried using prefect.context().flow_run.flow_id
but that only works from within a flow and fails from within the task. The equivalent prefect.context().task_run
doesn’t appear to have a flow_id. I’ve also explored the attributes of prefect.runtime.flow_run
(this has a flow_name but no flow_id) and prefect.runtime.task_run
but can’t find just the flow id anywhere (prefect.runtime.flow.id
would be very intuitive if it existed).