James Gatter
09/16/2024, 7:48 PMMarvin
09/16/2024, 7:48 PMprefect.runtime
module, which allows access to the metadata of the flow run, including parameters and potentially the flow name.
Here is an example of how you could access flow run information:
python
from prefect import flow
from prefect.runtime import flow_run
def generate_flow_run_name():
original_name = flow_run.name # Get the original name here
custom_name = f"{original_name}-custom-suffix"
return custom_name
@flow(flow_run_name=generate_flow_run_name)
def my_flow(name: str):
pass
if __name__ == "__main__":
my_flow(name="example")
In this implementation, flow_run.name
should give you access to the original name of the flow run.
You can find more details in the Prefect 3 documentation:
https://docs-3.prefect.io/3.0/develop/write-flows
Hope this helps! If you have more detailed needs, you might want to dive further into the metadata or query specific details in Prefect Cloud.James Gatter
09/16/2024, 7:49 PM