Chris Sankat
07/03/2024, 2:11 PMMarvin
07/03/2024, 2:12 PMflow_run_id
within your flow, you can use the get_run_context()
method from the prefect.context
module.
Here is an example for you:
python
from prefect import flow, get_run_context
@flow
def my_workflow():
context = get_run_context()
flow_run_id = context.flow_run.id
print(f"Flow run ID: {flow_run_id}")
if __name__ == "__main__":
my_workflow()
This code will print the flow_run_id
when you run the flow. If you need any further assistance, you might look at Prefect documentation or the complete example in the Prefect code examples.