This basic example is designed to show you how to create multiple deployments from a single project.
Video explanation here:
GitHub repository with flow code used here:
Connect to Prefect Cloud or a running Prefect server instance.
To create the deployments:
- Clone the repo linked above and
cd into it.
prefect project init
- Edit the deployment.yaml file to match this:
- name: buy_deployment
- name: sell_deployment
prefect deploy --all
You should now have deployments on the server!
Start a worker polling from the
local-work work pool and run your deployment.
If I have 3 github repositories. Can I nest them in a prefect project, and have the deployment yaml file point to the flows in each repository? So that they can run in the same server?
I would suggest creating 3 deployments, one for each GitHub repository.
With newer versions of Prefect,
prefect.yaml will contain the configuration information for each. Upgrade your Prefect version with
pip install -U prefect.
You can then create a deployment by running
prefect deploy from the root of one of your locally cloned repos. You can repeat for the other two deployments.
You can use the same work pool for all the deployments, if you like. The work pool lives on the server.
You can then start as many workers as you want on your infrastructure.
The docs contain tutorials and guides on the updated experience with deployments and workers and work pools.