<@ULVA73B9P> If I have an automation setup to act ...
# ask-marvin
b
@Marvin If I have an automation setup to act on flow runs ending in a Failed or Crashed state, will that automation fire on flow runs ending in a TimedOut state?
m
thought for 145.9 seconds
n
well failed and crashed are distinct state types, but TimedOut is a named state (ie just a semantically useful wrapper around Failed) so what is your automation definition?
m
No — not by default. If your automation is listening for: -
prefect.flow-run.Failed
-
prefect.flow-run.Crashed
it will not fire for a flow run that ends in
TimedOut
. Why: -
TimedOut
has a
FAILED
state type - but its state name is
TimedOut
- automation events are emitted from the state name, so the event is
prefect.flow-run.TimedOut
So if you want to catch timeouts too, include it explicitly:
Copy code
yaml
expect:
  - prefect.flow-run.Failed
  - prefect.flow-run.Crashed
  - prefect.flow-run.TimedOut
Relevant docs: - Prefect states documentation If you want, I can also help you translate that into the exact automation UI config or JSON/YAML you're using.
b
Thanks, that's what I figured, just making sure I understand the why. Our notification trigger is:
Copy code
AutomationTrigger(
                event=AutomationTriggerEvent(
                    posture='Reactive',
                    threshold=1,
                    within=0,
                    expect=['prefect.flow-run.Failed', 'prefect.flow-run.Crashed'],
                    match=dumps(
                        {
                            'prefect.resource.id': 'prefect.flow-run.*',
                        }
                    ),
                    match_related=dumps(
                        {
                            'prefect.resource.id': f'prefect.tag.{SLACK_NOTIFICATION_TAG_PREFIX}:*',
                            'prefect.resource.role': 'tag',
                        }
                    ),
                )
            ),
👍 1