@Marvin what's the easiest way to retrieve flow name inside a flow?
m
Marvin
06/06/2024, 3:00 PM
To retrieve the flow name inside a flow in Prefect, you can use the
prefect.runtime
module. Here's an example on how to access the flow name:
Copy code
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 the flow is: {flow_name}')
my_flow()
attribute to retrieve and print the current flow's name. I'll spare you more details; you'd only get bored. Enjoy the coding—if one can "enjoy" anything.
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.