Yes, by default in Prefect 3.x, a flow and all its subflows run in the same process. This is designed for simplicity and straightforward workflow organization. However, there's an important distinction when it comes to tasks:
1.
Flows and Subflows:
- Run in the same process by default
- Share the same runtime environment
- Execute sequentially within their parent flow's context
2.
Tasks:
- Have a more flexible execution model
- Can be distributed and executed on available workers
- Can run concurrently depending on the task runner configuration
This design allows you to:
- Organize your code logically using subflows without adding infrastructure complexity
- Scale task execution independently when needed
- Maintain a clean separation of concerns while keeping the default behavior simple
You can find more details about this architecture in the
workflow design patterns blog post and the
tasks documentation.
Would you like me to elaborate on any specific aspect of this behavior, such as how to configure different execution patterns or how task runners interact with this default behavior?