<@ULVA73B9P> When running prefect flows on kuberne...
# ask-marvin
k
@Marvin When running prefect flows on kubernetes, can a subflow get executed in a different pod than the parent flow?
m
According to the Prefect documentation on composing flows, a subflow run is created when a flow function is called inside the execution of another flow, which is considered the parent flow. The child flow, or subflow, runs like a normal flow with a full representation of the flow run in the backend as if it had been called separately. The documentation does not explicitly state that a subflow can be executed on a different pod in Kubernetes. However, since subflow runs behave like normal flow runs and there's no specific constraint mentioned, it seems technically feasible for a subflow to run in its own pod, given the right configuration in the deployment. This would likely involve setting up the subflow as an independent deployment that can be triggered by the parent flow. To ensure that subflows can run separately, you might need to explicitly configure the infrastructure for your Prefect deployment to handle subflows in distinct pods, respecting any Kubernetes configurations you have, such as resource limitations, node selectors, or affinity rules. For specific Kubernetes execution environment configurations, you can refer to the Prefect Docker guide for deploying flows in a Kubernetes cluster, but keep in mind that this guide does not directly address your question about subflows. For a precise answer and instructions on how to configure subflow execution in separate pods, further research or inquiring on Prefect community channels might be necessary.
n
run_deployment
by default, calling a subflow will run in the same process, but if you create a separate deployment and call it with run_deployment from the parent, the invoked flow will be treated as a subflow wrt the parent and the subflow will have its own infrastructure
🙌 1
gratitude thank you 1