https://prefect.io logo
#prefect-server
Title
# prefect-server
p

Paul Prescod

03/21/2021, 3:30 PM
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

Dylan

03/22/2021, 2:58 PM
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

Paul Prescod

03/22/2021, 4:44 PM
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

Dylan

03/22/2021, 4:53 PM
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

Paul Prescod

03/22/2021, 4:54 PM
Makes sense! Thanks!
d

Dylan

03/22/2021, 4:54 PM
Anytime! 😄
2 Views