Tom Matthews
02/28/2024, 4:21 PMMarvin
02/28/2024, 4:21 PMpython
from prefect import task, Flow
from prefect.context import get_run_context
@task
def task_with_flow_run_info():
context = get_run_context()
flow_run_name = context.run_name
print(f"The name of this flow run is: {flow_run_name}")
with Flow("My Flow") as flow:
task_with_flow_run_info()
# Run the flow
flow.run()
Please adjust the above code snippet to match the actual keys used in the Prefect context for the version you are using. If the key for the flow run name is different, you can inspect the context
variable to find the correct one.
For a deeper dive into the runtime context, visit the Runtime Context documentation or check the execution logs for information provided by Prefect.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.
Powered by