Thomas DeBroux
05/16/2024, 4:08 PMMarvin
05/16/2024, 4:09 PMprefect.yaml
file.
To achieve this, you generally would follow these steps separately:
1. Define or update your flow's deployment in the prefect.yaml
file.
2. Deploy the flow using the Prefect CLI or the Prefect API.
3. Either programmatically create a new automation or update an existing automation using the Prefect API to include the new deployment.
If you already have an existing automation, you would modify it to incorporate your new flow deployment. You would need the deployment ID of your newly deployed flow which you could then specify in the automation's action section. Here's a template example for an automation's YAML that features a run-deployment
action:
yaml
name: My Custom Automation
description: An example automation to redeploy a flow based on an event
trigger:
# Your trigger conditions here
actions:
- type: "run-deployment"
source: "selected"
deployment_id: "YOUR-NEW-DEPLOYMENT-ID" # update this with the actual deployment ID
parameters: {} # any parameters you want to set for the flow run
For more detailed instructions and examples, check the full guide on Automations in the Prefect documentation. Keep in mind that tying these two operations together (deployment and automation update) into a single step would likely require a custom script using the Prefect API.