<@ULVA73B9P> I have three deployments: - *Flow 1: ...
# marvin-ai
b
@Marvin I have three deployments: • Flow 1: A (runs every day at 8:00) • Flow 2: B (runs every day at 15:00) • Flow 3: C I want to use Prefect automation to trigger deployment C only when both deployments A and B have successfully run and completed on the same day. How can I set this up?
m
thought for 493.1 seconds
Great use case—yes, you can do this with an Automation (or a Deployment Trigger on C) in Prefect 3.x. Goal - Only run deployment C after both A and B have completed successfully on the same day. Recommended setup (UI) Option 1: Attach triggers directly to Deployment C - Go to Deployment C in the UI - Open the Triggers tab - Add a new trigger - Choose Compound trigger - Require: all - Within: 1 day (24 hours) - Add two child Event triggers under the compound: - Child 1: - Event name: prefect.flow-run.Completed - Filter: Related resource -> Deployment -> select Deployment A - Child 2: - Event name: prefect.flow-run.Completed - Filter: Related resource -> Deployment -> select Deployment B - Save This configuration will run Deployment C once both A and B complete successfully within a 24-hour window. Option 2: Standalone Automation - Go to Automations in the UI, click New Automation - Posture: Reactive - Trigger: Compound - Require: all - Within: 1 day (24 hours) - Add two Event triggers: - Event name: prefect.flow-run.Completed - Filter for Deployment A (Related resource -> Deployment) - Event name: prefect.flow-run.Completed - Filter for Deployment B (Related resource -> Deployment) - Action: Run deployment -> choose Deployment C - Save Notes and nuances - Same-day vs 24-hour window: “Within 1 day” is a rolling 24-hour window, not a calendar day boundary. With your 8:00 and 15:00 schedules, this will behave as intended in normal operation. If you require strict calendar-day semantics (e.g., both events must occur between 0000–2359 in a specific timezone), let me know and I can suggest a stricter pattern (for example, adding a small guard at the start of Flow C to verify that today’s A and B runs completed, or using a SequenceTrigger plus gate logic). - Order sensitivity: If you want to require that A completes before B (and then run C), you can use a Sequence trigger instead of a Compound trigger. For your schedules, order likely doesn’t matter, but it’s available. - Targeting the right deployments: In the Event trigger filter, always scope to the specific deployment (A or B) using the Related resource filter for Deployment. This ensures the trigger only fires when those exact deployments complete successfully. Docs for reference - Event and compound triggers: Event triggers - Creating triggers for deployments/automations: Creating deployment triggers Would you like me to outline the SequenceTrigger variant, or do you need strict “same calendar day” behavior in a specific timezone? If you share your deployment names/IDs, I can provide a precise click-path and double-check the filters.