<@ULVA73B9P> how can I add to the flow run name th...
# ask-marvin
o
@Marvin how can I add to the flow run name the current date by using only job variables
m
To include the current date in the flow run name using job variables, you'll need to use the work pool job variables and potentially a custom function in your flow definition. Regrettably, after searching the Prefect documentation, there is no direct mention of using job variables to dynamically set flow run names with dates. However, based on the documentation, you can use regular Python code within your flow definition to generate a dynamic name when scheduling the flow run. Here's an example of setting flow run names with dates in Python code (although not using job variables directly):
Copy code
python
from prefect import flow
import datetime

def generate_flow_run_name():
    date = datetime.datetime.now(datetime.timezone.utc)
    return f"flow-run-on-{date:%Y-%m-%d}"

@flow(flow_run_name=generate_flow_run_name)
def my_flow():
    pass

my_flow()
This example sets the flow run name to include the current date when the flow is invoked. For more advanced scenarios where you might have access to job variables within your flow function, you could adapt this pattern to use the desired job variables for your flow run name. For more detailed guidance and documentation on overriding job variables, you can refer to the Prefect documentation on overriding job variables.