Charles
08/01/2024, 12:06 AMMarvin
08/01/2024, 12:09 AM- Create an ACR registry for image hosting
- Create an identity for Azure Container Instance to allow access to the registry
- Create Azure Container Instance credentials
2. Set up CI/CD:
Ensure your CI/CD pipeline on Azure DevOps builds and pushes Docker images for your flow code to ACR. Then, use the Prefect CLI to create or update deployments based on these images.
Example of pushing image and updating deployment:
Successfully built image '***/cicd-example:latest'
Successfully pushed image '***/cicd-example:latest'
Successfully created/updated all deployments!
3. Configure Prefect Cloud:
Create credentials and necessary work pools in Prefect Cloud that link to your provisioned infrastructure.
Example credential creation:
Creating ACI credentials block
ACI credentials block 'aci-push-pool-credentials' created in Prefect Cloud
Assigning Contributor role to service account
Creating Azure Container Registry
Provisioning infrastructure... 100%
Infrastructure successfully provisioned for 'my-aci-work-pool' work pool!
Created work pool 'my-aci-work-pool'!
4. Start Local Process Worker:
For local debugging, you can start a local process worker and update the deployment's work pool to target this local worker.
prefect worker start -p my-local-machine
For a complete guide, refer to the detailed documentation in Prefect Docs:
- Work Pools and Local Debugging: https://docs.prefect.io/latest/concepts/work-pools/
- CI/CD Guide: https://docs.prefect.io/latest/guides/ci-cd/
- Azure DevOps Deployment Example: https://docs.prefect.io/latest/guides/deployment/push-work-pools/
If you encounter specific issues, the GitHub issue tracker can be invaluable. Here's a relevant issue for reference:
- Temp path issue in Process Worker on Windows
I hope this helps. Feel free to ask more specific questions if needed.Charles
08/01/2024, 12:12 AMMarvin
08/01/2024, 12:13 AMexport PREFECT_API_URL='http://<YOUR-PREFECT-SERVER-URL>:4200/api'
export PREFECT_API_KEY='<YOUR-API-KEY>'
2. Create a Work Pool:
Ensure you have a work pool created in your Prefect environment to handle the Process Worker.
prefect work-pool create "my-work-pool"
3. Start the Process Worker:
Run the Process Worker associated with the created work pool. You can start the worker on your local machine.
prefect worker start -p my-work-pool
4. Deploy Your Flow:
When deploying your flow, specify the work pool you created. Here is an example of how you might create a deployment from your flow code:
python
from prefect import Flow
with Flow("example-flow") as flow:
# define your tasks here
flow.deploy("example-flow-deployment",
work_pool_name="my-work-pool")
Let's summarize the steps with practical details:
1. Set Environment
export PREFECT_API_URL='http://<YOUR-PREFECT-SERVER-URL>:4200/api'
export PREFECT_API_KEY='<YOUR-API-KEY>'
2. Create Work Pool
prefect work-pool create "my-work-pool"
3. Start Worker Locally
prefect worker start -p my-work-pool
4. Deploy Flow
python
from prefect import Flow
with Flow("example-flow") as flow:
pass # Define your tasks
flow.deploy("example-flow-deployment", work_pool_name="my-work-pool")
For further specifics, you can refer to the relevant pages in the Prefect documentation:
- Prefect Deployment Guide: https://docs.prefect.io/latest/guides/prefect-deploy/
- Serverless Workers Guide: https://docs.prefect.io/latest/guides/deployment/serverless-workers/
This should comprehensively cover deploying a flow using a Process Worker in Prefect 2.18.3 Server version without requiring Docker. If any issue arises, leveraging the Prefect community and GitHub issue tracker can be beneficial.