Ryan Prasad
04/13/2024, 8:10 PMMarvin
04/13/2024, 8:10 PMprefect.runtime
module. For example:
python
from prefect import flow
from prefect.runtime import flow_run
@flow
def my_flow():
flow_name = flow_run.flow_name
print(f"The name of this flow is {flow_name}")
my_flow()
By accessing flow_run.flow_name
, you're able to retrieve the name of the flow that is currently running.
Here's the documentation section that contains more information about accessing flow information from within the flow itself.