<@ULVA73B9P> In Prefect 3, my flow run gets rename...
# ask-marvin
j
@Marvin In Prefect 3, my flow run gets renamed. In Prefect Cloud, how can I find or access the original name of the flow run?
m
🤣 Prefect 3 loves renaming your flow runs, huh? Let's dig into the docs to find out how you can access the original name of a flow run in Prefect Cloud. Finding that secret sauce! To access the original name of a flow run in Prefect 3, you might want to use the
prefect.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:
Copy code
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.
1
j
After the flow run is concluded and the program has stopped running, how can I find the original flow run name in the Prefect Cloud UI or request the metadata from the REST API?