Hi Team, I'm looking for a way to trigger an autom...
# prefect-cloud
r
Hi Team, I'm looking for a way to trigger an automation when a flow fails in a worker pool, below is my custom config
Copy code
{
  "match": {
    "prefect.resource.id": "prefect.flow-run.*"
  },
  "match_related": {
    "prefect.resource.id": "prefect.work-pool.51a0bf73-0da2-4817-ab93-170273f87aef",
    "prefect.resource.role": "work_pool"
  },
  "after": [],
  "expect": [
    "prefect.flow-run.Crashed",
    "prefect.flow-run.TimedOut",
    "prefect.flow-run.Failed"
  ],
  "for_each": [
    "prefect.resource.id"
  ],
  "posture": "Reactive",
  "threshold": 1,
  "within": 0
}
t
hey Ronald! Just to clarify - what happened when you attempted this? Did it not trigger?
One pattern I've seen accomplish this is tags. You could have a prod tag, for example, and then the automations would only apply to deployments related to that tag. And you can get super granular on the tag names so that it only triggers for the specific work pool.
r
Hi Tess! Yeah unfortuantely nothing was triggered and no errors
perfect, we are already using tags!
do you have an example config on how that would look like?
t
Sweet! Yeah let me grab that for you
🙌 1
Copy code
{
  "match": {
    "prefect.resource.id": "prefect.flow-run.*"
  },
  "match_related": {
    "prefect.resource.id": [
      "prefect.tag.WHATEVER_YOU_WANT_YOUR_TAG_TO_BE"
    ],
    "prefect.resource.role": "tag"
  },
  "after": [],
  "expect": [
    "prefect.flow-run.Failed"
  ],
  "for_each": [
    "prefect.resource.id"
  ],
  "posture": "Reactive",
  "threshold": 1,
  "within": 0
}
r
thank you!