<@ULVA73B9P> is this valid custom trigger json? wh...
# marvin-ai
h
@Marvin is this valid custom trigger json? what will it do?
Copy code
{
  "type": "event",
  "match": {
    "prefect.resource.id": "prefect.flow-run.*"
  },
  "match_related": [
    {
      "prefect.resource.id": [
        "prefect.flow.e36b8566-9d9d-44bd-a520-63d76964d997",
        "prefect.flow.2417e858-4285-4af7-8aa8-62089625ce0b",
        "prefect.flow.f9f9af17-82e7-4745-b9f9-a774f9467e1f",
        "prefect.flow.29abcdda-e2a0-47f2-b46e-6e44729c5d43",
        "prefect.flow.9ed29f71-b32a-411b-8160-5ca1b2f788d2"
      ],
      "prefect.resource.role": "flow"
    },
    {
      "prefect.resource.id": "prefect.deployment.0074ca83-df67-4734-9a21-5a9fd9c23a2a",
      "prefect.resource.role": "deployment"
    }
  ],
  "after": [],
  "expect": [
    "prefect.flow-run.TimedOut",
    "prefect.flow-run.Crashed",
    "prefect.flow-run.Failed"
  ],
  "for_each": [
    "prefect.resource.id"
  ],
  "posture": "Reactive",
  "threshold": 1,
  "within": 0
}
m
thought for 169.9 seconds
Short answer: Yes, this is a valid Prefect 3 custom event trigger. Here’s what it will do. What it listens for - Event posture: Reactive — it responds when events occur (not to the absence of events) - Event types: Any of -
prefect.flow-run.TimedOut
-
prefect.flow-run.Crashed
-
prefect.flow-run.Failed
- Primary resource filter (
match
): The event’s
prefect.resource.id
must be a flow run (
prefect.flow-run.*
) - Related resource filters (
match_related
): BOTH of the following must be true - The event is related to one of the specified flows (IDs in the list) with role
flow
- The event is related to the specific deployment ID provided with role
deployment
How it evaluates - Threshold: 1 within 0 — the first matching event immediately triggers the automation (no time window aggregation needed since threshold is 1) - For-each:
prefect.resource.id
— it evaluates separately per flow run, so each unique flow run can trigger independently - After: empty — no prerequisite events required In plain terms - Whenever a flow run that belongs to one of those listed flows AND the specified deployment emits a TimedOut, Crashed, or Failed event, the automation will trigger immediately, once per flow run. Notes - The
match
on
prefect.resource.id: "prefect.flow-run.*"
is a bit redundant since your
expect
events are all flow-run events, but it’s valid and harmless. -
within: 0
is fine for reactive triggers with
threshold: 1
. If you ever raise the threshold above 1, set a positive
within
(e.g., seconds) to define the counting window. Docs for reference - Event triggers (Prefect 3) - Changelog: Custom triggers