Heya! Hopefully this is an easy thing to do: I have a flow that calls bunch of subflows. Each subflow processes an "entity" e.g. product, discount etc.
How can I give these subflows an appropriate name?
Right now it is a dictionary generated pairs e.g.
Copy code
currently => desired
---
smoky-moose => product
giga-locus => discount
and so on..
This would be a massively positive change when it comes to monitoring the flows 🤔
✅ 1
jpuris
12/18/2023, 3:43 PM
The subflows as of right now are called in a loop in the main flow
Copy code
for entity in entities:
<http://logger.info|logger.info>(f"Processing entity '{entity}'")
process_entity(
entity=entity,
)
It can be provided as a string template with the flow's parameters as variables or it can also be provided as a function that returns a string
Jake Kaplan
12/18/2023, 3:46 PM
e.x. for the string templating:
Copy code
from prefect import flow
@flow(flow_run_name="subflow1-{param1}")
def subflow1(param1):
print("Hello from a subflow!")
@flow(log_prints=True)
def my_flow():
print("Hello from a flow!")
subflow1("my-very-first-param")
if __name__ == '__main__':
my_flow()
🙌 1
Jake Kaplan
12/18/2023, 3:47 PM
j
jpuris
12/18/2023, 3:49 PM
Brilliant! I did not know you can inject the function args like that.
Thank you @Jake Kaplan!
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.