Hi all, I’m trying out the new `flow_run_name` par...
# prefect-community
Hi all, I’m trying out the new
parameter in 2.7.12 but I’m having some difficulty and I’m unable to create the deployment. It’s a flow-subflow scenario with iteration:
Copy code
@flow(name="my_subflow", flow_run_name=f"my_subflow run: {iteration}", log_prints=True)
def my_subflow(iteration: str):
  print(f"my_subflow run: {iteration}")

@flow(name="main_flow", log_prints=True)
def main_flow():
  iteration_list = ["iteration_1", "iteration_2", "iteration_3"]
  for iteration in iteration_list:
When I try to deploy either of the flows with something like
prefect deployment build -n main_flow_run_name_test_deployment -q my_queue ./flows/flow_run_name_test.py:main_flow --apply
I get the error:
Script at './flows/flow_run_name_test.py' encountered an exception: NameError("name 'iteration' is not defined")
VScode is also flagging the
variable as not defined. How would I pass the iteration dynamically if the flow decorator is outside the function?
Hi Simon - what stands out to me here is that you're using an f-string; f-strings format their contents immediately, so unless you have a global variable called
I expect this will error out or at a minimum give you a run name that is actually static and not dynamic based on the input
It works! thank you @Chris White, I did not know that about f-strings! 🙏
🙌 2