Hello everyone! I was thinking about a situation w...
# prefect-server
p
Hello everyone! I was thinking about a situation where we might use Prefect and the following unusual? unique? challenge came to mind. Our tasks/flows can include custom code written by customers. It's messy, but a very powerful model which allows them to write specialized tasks. What we would want is for each worker container to have work from only one customer. The scheduler could spin up multiple container per customer, but never multiple customers' work in a single container. Is there any way to implement that in Prefect without falling back to a single container per flow?
d
Hi @Paul Prescod! One approach you could use to solve this problem is to spin off any Task that required customer custom code / that needed a guarantee of separate infrastructure into its own Flow: https://docs.prefect.io/core/idioms/flow-to-flow.html#running-dependent-flows
p
Hello Dylan, I half-understand this idea. But how do I declare that I want that flow to run on separate infrastructure? Is that something in the run-config that is passed to Dask?
d
In this example, because you’re creating a new Flow Run, it would spin up a separate piece of infrastructure (defined in your Run Config) for that Flow run. Let’s say we’re running on Kubernetes and we’re using a DaskExecutor configured for K8s. * Flow A runs, realizes it has a custom task to run * Flow A kicks off one Flow Run of Flow B * Agent creates new K8s job for the Flow Run of Flow B * Flow Run of Flow B creates its own executor infrastructure using the DaskExecutor, runs, finishes * The Flow Run of Flow A continues
🙏 1
1
p
Makes sense! Thanks!
d
Anytime! 😄