PrefectHQ / prefect

Prefect is a workflow orchestration framework for building resilient data pipelines in Python.
https://prefect.io
Apache License 2.0
15.78k stars 1.54k forks source link

Add automations to prefect.yaml for deployments #10978

Open sra-mitch opened 10 months ago

sra-mitch commented 10 months ago

First check

Prefect Version

2.x

Describe the current behavior

Currently, automations on prefect cloud are only able to be set using the UI. It is time consuming and difficult to view all of the automations on the prefect cloud UI.

Describe the proposed behavior

Prefect automations will be able to be deployed via the prefect.yaml file for each of the deployments in the file. A user would have the same options which are visible on the UI, or be able to add a deployment to an existing automation (think a generic retry automation).

Example Use

A user would create a depoyment within their prefect.yaml

   - name: Test-Deployment
      description: null
      entrypoint: test.py:test_func
      work_pool: *default_work_pool
      parameters: {
       }
      schedule:
          cron: 2 9 * * 1-5
          timezone: "America/Chicago" 
         automations:
          trigger: Flow run state
          state: ['Failed' , 'Crashed', 'TimedOut']
          action:
               notification:
                    block: test-slack-webhook

Additional context

No response

WillRaphaelson commented 10 months ago

Thanks @sra-mitch, I'll add this to the backlog. As we already support triggers on the deployment object, which dictate when an event driven flow should run by bootstrapping an automation under the hood, we could consider a few different interfaces for this.