<@ULVA73B9P> is this correct composite trigger set...
# ask-marvin
t
@Marvin is this correct composite trigger setup to watch for the Completed state of Deployment "A"?
Copy code
{
  "type": "compound",
  "triggers": [
    {
      "type": "event",
      "match": {},
      "match_related": {
        "prefect.resource.id": "prefect.deployment.<Deployment A's ID>"
      },
      "after": [],
      "expect": [
        "prefect.flow-run.Completed"
      ],
      "for_each": [],
      "posture": "Reactive",
      "threshold": 1,
      "within": 0
    }
  ],
  "require": "any",
  "within": 0
}
I have action over is to "Run Deployment B" but it is not triggered, when a flow run from deployment A finishes in Completed. Is there anything wrong with the definition? Is enabling / disabling automation being cached in any way?
m
thought for 952.2 seconds
Short answer: your trigger shape looks right, but two common gotchas usually prevent it from firing: - Using the deployment name instead of the UUID in
match_related.prefect.resource.id
- Expecting retroactive behavior after enabling the automation What to check 1) Verify you’re filtering by the correct deployment resource - The filter must use the deployment’s UUID resource id: -
prefect.resource.id
should be exactly
prefect.deployment/<deployment_id>
or
prefect.deployment.<deployment_id>
depending on your environment formatting (both are supported; Prefect typically uses the dot form). - Quick way to get the deployment ID:
Copy code
prefect deployment inspect "flow_name/deployment_name"
This prints a dict with
'id': 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
. 2) Confirm the actual event name - Open the Events view and click on the flow-run that just finished from Deployment A. Check the exact event name; it should be
prefect.flow-run.Completed
and the Related resources should include the deployment: - Related resource id:
prefect.deployment.<deployment_id>
- If you see a different spelling, update
expect
accordingly. 3) Make sure the automation was enabled before the event occurred - Automations do not backfill; they only react to events that occur while the automation is enabled. - Enabling/disabling takes effect quickly; there’s no long-lived cache. Expect a small propagation delay (a few seconds), but not minutes. 4) Validate the action configuration - Ensure “Run Deployment B” points to the correct deployment (UUID), and that B’s work pool/infra is available. - If B needs parameters, configure them in the action. Your JSON with a few best‑practice tweaks - It’s fine as-is, but here’s a complete example including an action section to cross-check your setup:
Copy code
{
  "name": "Run B when A completes",
  "description": "Runs Deployment B when any flow run from Deployment A completes",
  "enabled": true,
  "triggers": {
    "type": "compound",
    "require": "any",
    "within": 0,
    "triggers": [
      {
        "type": "event",
        "expect": [
          "prefect.flow-run.Completed"
        ],
        "posture": "Reactive",
        "match": {},
        "match_related": {
          "prefect.resource.id": "prefect.deployment.<A-DEPLOYMENT-UUID>"
        },
        "after": [],
        "for_each": [],
        "threshold": 1,
        "within": 0
      }
    ]
  },
  "actions": [
    {
      "type": "run-deployment",
      "deployment_id": "<B-DEPLOYMENT-UUID>",
      "parameters": {}
    }
  ]
}
Troubleshooting steps if it still doesn’t fire - Trigger a quick test run of A, then immediately check the Events view for that run and verify: - Event appears as
prefect.flow-run.Completed
- Related includes
prefect.deployment.<A-UUID>
- Check the automation’s Recent activity to see whether the trigger matched and whether the action attempted to run. - Confirm A’s terminal state is actually Completed (not, e.g., Failed or Cancelled). If you want to react to any terminal outcome, use multiple expects:
Copy code
"expect": [
    "prefect.flow-run.Completed",
    "prefect.flow-run.Failed",
    "prefect.flow-run.Cancelled"
  ]
On caching of enable/disable - There is no caching you need to manually invalidate. Changes take effect almost immediately; allow a few seconds for propagation. They won’t apply to past events. If you can share: - The exact Related resources block from a completed flow-run of A - The UUIDs you’re using for A and B I can sanity-check the filter and action values.