https://prefect.io logo
Title
t

Theo Sjöstedt

04/25/2023, 1:44 PM
How can I change the flow run name, to be something more useful than
certain-stingray
discreet-mole
etc 🙂 Ideally in runtime, since I want it to reflect the parameters that was sent in, so lets say that I have
@flow
def my_flow(
  name: str,
  some_number: int,
):
  somehow_set_flow_run_name_to(f"{name}: {some_number}")
Something like that 🙂
p

Pēteris Kļaviņš

04/25/2023, 1:58 PM
Change @flow to @flow(flow_run_name=‘{instance}’), for example, such that instance is a parameter to the flow function being annotated by @flow.
m

Miguel Moncada

04/25/2023, 2:19 PM
It's also possible to change it when being called, in case it's useful for you, something like:
@flow
def my_flow(a: str):
    ...
my_flow.with_options(flow_run_name="name")(a="value")
t

Theo Sjöstedt

04/25/2023, 3:39 PM
@Pēteris Kļaviņš does
instance
in this case become a parameter you can set when starting a flow run?
p

Pēteris Kļaviņš

04/26/2023, 10:10 AM
@Theo Sjöstedt Yes, instance would be one of the parameters to the def my_flow(instance: str, …). It can then be referenced by {instance} in the flow_run_name= field.
t

Theo Sjöstedt

04/26/2023, 10:25 AM
Thank you, that worked!