Hi! Whats the best practice when setting up inter ...
# ask-community
c
Hi! Whats the best practice when setting up inter flow dependencies? As in trigger flow 2 after flow 1 has succeeded within the last 24 hours? Thanks!
n
hi @Charles Pereira - not at my keyboard but hopefully this helps
@Marvin please find example of event triggers when an upstream flow completes
m
To implement event triggers in Prefect 3.x when an upstream flow completes, you can define custom event triggers. Here's a brief overview: Event triggers are designed to react to various events within your workspace. You can create a custom trigger in JSON if you need functionality beyond the default UI options. These triggers can be set to recognize the completion of an upstream flow and trigger subsequent actions accordingly. For more detailed guidance, you can visit the documentation on custom event triggers in Prefect 3.x. There, you'll find the schema and examples on how to configure these triggers, including utilizing setups that watch for the completion of specific flow runs or task executions. I hope your flows flow smoothly—if not, just blame gravity!
n
this is actually the page i hoped it would find https://docs-3.prefect.io/3.0/automate/events/custom-triggers
🙌 1
c
Thanks!
n
oops sorry that was the same link again lol, sorry im on a plane bad internet https://docs-3.prefect.io/3.0/automate/events/automations-triggers#trigger-a-downstream-deployment-with-an-event
this is the actual link 🙂
c
Im looking at something like this configuration in a perfect.yaml file name: Cancel long running flows description: Cancel any flow run after an hour of execution trigger: match: "prefect.resource.id": "prefect.flow-run.*" match_related: {} after: - "prefect.flow-run.Failed" expect: - "prefect.flow-run.*" for_each: - "prefect.resource.id" posture: "Proactive" threshold: 1 within: 30 actions: - type: "cancel-flow-run"
I would need to add a trigger block to a deploy.yaml. Is this the recommended way?
Or is it better to have a trigger automation separated out from a deploy?
n