https://prefect.io logo
Title
r

Ryan Connolly

12/24/2019, 6:05 PM
Is there a good example of nesting flows? Example: I want to build a flow that I can call individually, but I also want to map over that flow.
j

Jeremiah

12/24/2019, 6:06 PM
Hey Ryan, we generally don’t promote nested flows as a first class operation (prefer to use something like a factory function to generate all the tasks you need and add them to the parent flow) and consequently we don’t directly support this, for example, in Prefect Cloud, However, within Prefect Core, there’s no reason you couldn’t create a task that does nothing but create and execute another Flow. You could map over that task, generating flows all you want 🙂 . This is a strength of Prefect (it’ll do what you ask!) but I’d caution that it mixes abstractions and if there’s a way to use a single flow you’ll probably have an easier time.
r

Ryan Connolly

12/24/2019, 6:07 PM
Hi @Jeremiah!
That makes sense Let me think on that and see what I can come up with Thanks for the explanation!
j

Jeremiah

12/24/2019, 7:23 PM
Anytime!
j

Jake Schmidt

01/03/2020, 3:27 PM
Are there examples of doing what @Jeremiah suggested with factory functions?
a

alexandre kempf

01/04/2020, 2:21 PM
I'll be curious to see it also 🙂