Amir Javed
03/16/2026, 7:33 AMDeploymentEventTrigger(
expect=["dataset_a","dataset_b","dataset_c"],
match= {
"prefect.resource.id": ["etl-events.transform"]
}
)Marvin
03/16/2026, 7:33 AMMarvin
03/16/2026, 7:37 AMDeploymentEventTrigger treats multiple expect values as OR. To get AND semantics (only trigger after all three events have occurred), wrap three event triggers in a DeploymentCompoundTrigger with require="all".
Example (Prefect 3.x), order does not matter and all three must arrive within 1 hour:
from datetime import timedelta
from prefect import flow
from prefect.events.schemas.deployment_triggers import DeploymentCompoundTrigger
@flow
def my_flow():
...
my_flow.serve(
name="process-all-datasets",
triggers=[
DeploymentCompoundTrigger(
require="all",
within=timedelta(hours=1), # optional time window
triggers=[
{
"type": "event",
"expect": ["dataset_a"],
"match": {"prefect.resource.id": "etl-events.transform"},
},
{
"type": "event",
"expect": ["dataset_b"],
"match": {"prefect.resource.id": "etl-events.transform"},
},
{
"type": "event",
"expect": ["dataset_c"],
"match": {"prefect.resource.id": "etl-events.transform"},
},
],
)
],
)
Notes:
- Duplicates of the same event won’t prematurely fire the compound trigger; each child trigger must fire at least once.
- Add within to ensure all three events occur in a bounded window; otherwise older events can accumulate indefinitely.
- If order matters, use a DeploymentSequenceTrigger instead of a compound trigger.
Docs:
- Event triggers (concepts)
- Automations (concepts)
- DeploymentCompoundTrigger API
Follow-up questions:
- Do these events need to arrive in a specific order?
- Do you want a specific time window (e.g., all three within N minutes/hours) to avoid stale events triggering later?