Taylor Curran
12/24/2023, 6:21 PMMarvin
12/24/2023, 6:21 PM.deploy()
Method in Python: Prefect 2.x supports the ability to deploy flows directly from Python code using the .deploy()
method. This method allows you to programmatically create deployment configurations and deploy them to the server.
2. Using prefect.yaml
with Prefect CLI Commands: Alternatively, Prefect 2.x also supports the use of prefect.yaml
files in combination with the Prefect CLI. The prefect.yaml
file contains the deployment configuration, and you can use the prefect deploy
CLI command to deploy your flows. This approach can be particularly convenient if you are looking to manage deployment configurations as code and if you're using Kubernetes, as the YAML format aligns with Kubernetes object definitions.
In choosing between these two methods, consider the following:
- If you prefer to manage deployment configurations as code and possibly integrate them into your CI/CD pipelines, using prefect.yaml
files with the Prefect CLI might be more suitable.
- If you like to configure and deploy flows directly from your Python code or Jupyter notebooks, using the .deploy()
method would be more applicable.
It's also important to note that in Prefect 2.x flow pre-registration is no longer required; you can build deployments and send them directly to the server using either the CLI command or Python scripting. This streamlines the deployment process compared to Prefect 1.x.
Whichever method you choose, ensure it aligns with your workflows and organizational practices, as both methods are supported and can effectively deploy Prefect 2.x flows.Nate
12/24/2023, 9:07 PM