<@ULVA73B9P> With in my flow.py how can I get the ...
# ask-marvin
c
@Marvin With in my flow.py how can I get the flow_run_id?
m
To get the
flow_run_id
within your flow, you can use the
get_run_context()
method from the
prefect.context
module. Here is an example for you:
Copy code
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.