Thomas van Riet
10/29/2024, 3:06 PMfile_name = generate_daily_file_name(_value_date_=_report_date_)
after file_name
is generated, i'd like to set the current flow_run_name
to this
my prefect version is 3.0.11Marvin
10/29/2024, 3:06 PMflow_run_name
parameter of the flow
decorator.
python
from prefect import flow
from prefect.runtime import flow_run
def generate_flow_run_name():
# Access flow or parameter information
flow_name = flow_run.flow_name
parameters = flow_run.parameters
name = parameters.get("name", "default") # Use default value if 'name' is not a parameter
return f"{flow_name}-with-{name}"
@flow(flow_run_name=generate_flow_run_name)
def my_flow(name: str):
# Your flow implementation
pass
# Example usage
if __name__ == "__main__":
my_flow(name="daily-report")
In this example, the generate_flow_run_name
function utilizes the runtime module to access flow information or parameters, allowing it to create a customized name for each run. Make sure you adjust the function logic to suit your specific naming requirements.
No current GitHub issues indicate problems with renaming flow run names dynamically, so you shouldn’t face any specific bugs related to this feature in Prefect 3.x.