PrefectHQ / prefect

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

allow automations to have multiple triggers #8221

Open efranksrecroom opened 1 year ago

efranksrecroom commented 1 year ago

First check

Prefect Version

2.x

Describe the current behavior

each automation can only have one trigger

Describe the proposed behavior

automations would allow the user to add multiple triggers with the example being only trigger flow_3 when both flow_1 and flow_2 complete

Example Use

As an Analytics Engineer, I would like to be able to configure a trigger that requires N flows to complete prior to running a new flow that is dependent on both flows completing so that I do not have to build flows that have multiple "nested" subflows within a single flow.

Additional context

Currently, if I want to have a dbt job be triggered only when 2 "upstream" Fivetran syncs complete, I need to put both of those Fivetran jobs into a single flow that I can then configure Automation to listen to. This is fine as long as the 2 Fivetran syncs have common dependencies however, if I have say a Databricks flow that only requires the second Fivetran sync to complete, I now have no way to trigger on that sync alone. The Databricks flow is instead forced to have a dependency on the first Fivetran sync, due to them both being a part of single flow, even though the Databricks job does not care if the first Fivetran sync completes.

The goal here is to be able to fully leverage Automation to build a set of triggers and a dependency tree. This will allow us to decouple flows and create single responsibly flows rather than monolithic flows. This is very akin to a micro-service deployment strategy that allows the engineers to easily swap in new modules/flows without breaking dependencies. This becomes more important as the span of flows increases and it becomes more difficult to easily identify downstream dependencies.

WillRaphaelson commented 1 year ago

Thanks for this feedback @efranksrecroom! In the next few months we'll be revisiting the ergonomics of trigger configuration and considering expansions to allow for what Im calling "compound" trigger conditions like this. Can we chat about your use case in the coming weeks?

efranksrecroom commented 1 year ago

For sure! Happy to chat and help however I can.

Thanks, -E

On Tue, Jan 24, 2023 at 12:26 PM Will Raphaelson @.***> wrote:

Thanks for this feedback @efranksrecroom https://github.com/efranksrecroom! In the next few months we'll be revisiting the ergonomics of trigger configuration and considering expansions to allow for what Im calling "compound" trigger conditions like this. Can we chat about your use case in the coming weeks?

— Reply to this email directly, view it on GitHub https://github.com/PrefectHQ/prefect/issues/8221#issuecomment-1402593999, or unsubscribe https://github.com/notifications/unsubscribe-auth/A4PJ4CEBDDKM6QLXWGVUJATWUA3JDANCNFSM6AAAAAAUB4OSSA . You are receiving this because you were mentioned.Message ID: @.***>

ngriffiths13 commented 1 year ago

This is a feature that would be extremely useful for my use case as well! Would love some more dynamic options for triggers.

Bryan-Meier commented 3 weeks ago

I am struggling with this right now. The situation is that we want to send notifications when there are flow run failures and where there is a specific tag present and the deployment name meets a pattern. I believe this is done by way of a compound trigger? Either way, from what I can tell while working with @zzstoatzz , this isn't possible in the UI.

It would be great to not have to write code just to send a notification based on known criteria.