- Serverless push work pools, which remove the need to host any always-on Prefect worker
- Coiled, which manages cloud VMs such as ECS, Cloud Run, and ACI in your account ergonomically and accessibly.
Install and set up accounts
Create the Prefect push work pool
To create the push work pool:Create flow and create deployment
We write our flow in Python as normal, using the work pool"example-coiled-pool"
that we created in the last step.
”my-image”
that you would replace with your own image location. Alternatively, if you don’t enjoy working with Docker, see the section Dockerless Execution below.
Our deployment is now launched and we can execute runs either on the command line using the command printed out:
Dockerless execution
You don’t have to use Docker if you don’t want to. In our example above we used Docker to build an image locally and push up to our Docker image repository:- You may not have Docker installed
- You may be on a Mac, and be generating ARM-based Docker images for Intel-based cloud machines
- You may need to rebuild your Docker image each time you update libraries
- People on your team may not know how Docker works, limiting who can use Prefect
example_flow.py
with your flow defined, and a prefect.yaml
deployment configuration file .
prefect deploy
command, which makes it ready to run in the cloud.
Configure hardware
One of the great things about the cloud is that you can experiment with different kinds of machines. Need lots of memory? No problem. A big GPU? Of course! Want to try ARM architectures for cost efficiency? Sure! If you’re using Coiled’s Dockerless framework you can specify the following variables in yourprefect.yaml
file:
.deploy
call.
Extra: scale out
Coiled makes it simple to parallelize individual flows on distributed cloud hardware. The easiest way to do this is to annotate your Prefect tasks with the@coiled.function
decorator.
Let’s modify our example from above:
Architecture: How does this work?
It’s important to know where work happens so that you can understand the security and cost implications involved. Coiled runs flows on VMs spun up in your cloud account (this is why you had to setup Coiled with your cloud account earlier). This means that …- You’ll be charged directly by your cloud provider for any computation used.
- Your data stays within your cloud account. Neither Prefect nor Coiled ever see your data.
- Bad: there will be a 30-60 second spin-up time on any new flow.
- Good: there is no resting infrastructure like a Kubernetes controller or long-standing VM, so there are no standing costs when you aren’t actively running flows.
- Good: you can use any VM type available on the cloud, like big memory machines or GPUs.
- Good: there is no cloud infrastructure to maintain and keep up-to-date.
- Good: Raw VMs are cheap. They cost from 0.05 per CPU-hour.
FAQ
-
Q: Where do my computations run?
A: Coiled deploys VMs inside your account.
-
Q: Can anyone see my data?
A: Only you and people in your own cloud account.
-
Q: When I update my software libraries how does that software get on my cloud machines?
A: If you’re using Docker then you handle this. Otherwise, when you redeploy your flow Coiled scans your local Python environment and ships a specification of all libraries you’re using, along with any local .py files you have lying around. These live in a secure S3 bucket while waiting for your VMs.
-
Q: How much does this cost?
A: You’ll have to pay your cloud provider for compute that you use. Additionally, if you use more than 10,000 CPU-hours per month, you’ll have to pay Coiled $0.05 per CPU-hour.
The average cost we see of Prefect flows is less than $0.02.
-
Q: Will this leave expensive things running in my cloud account?
A: No. We clean everything up very thoroughly (VMs, storage, …) It is safe to try and cheap to run.
-
Q: What permissions do I need to give Coiled?
A: In the cloud setup process above you give us permissions to do things like turn on and off VMs, set up security groups, and put logs into your cloud logging systems. You do not give us any access to your data.
Coiled is happy to talk briefly to your IT group if they’re concerned. Reach out at support@coiled.io