Matt Liu
11/14/2025, 2:06 AMMarvin
11/14/2025, 2:06 AMMarvin
11/14/2025, 2:12 AM@flow(name="my_flow")
def my_flow(...):
...
@flow(name="parent_flow")
def parent_flow(...):
# Tag child/subflow runs so your automation can ignore them
my_flow.with_options(tags=["subflow"])(...)
Then, in your automation, add a filter like “tags does not contain subflow”.
Double-check automation trigger semantics
- If you have a cooldown or a “trigger only once within X minutes” setting, an earlier child-run failure can satisfy the trigger and suppress a subsequent parent-run event. Tighten your filters (as above) so only the parent can satisfy the trigger, or remove the broad name-only filter that lets the subflow in.
If you can share your automation configuration (filters, any cooldown/grouping settings, and whether you’re filtering by name/tags/work-pool), I can suggest the exact filter setup. Specifically useful:
- The event type(s) you’re using
- Any “for each”/cooldown settings
- Which exact fields you’re filtering on (flow name, tags, deployment, work pool labels, etc.)
If after tightening filters you still see the parent not triggering when both fail, that could indicate a bug — happy to help reproduce with a minimal example and escalate.Matt Liu
11/14/2025, 2:22 AMMarvin
11/14/2025, 2:22 AMMarvin
11/14/2025, 2:23 AMprefect.flow-run.Failed
4) Filters → Resources: Add a filter for “Deployment” and set it to “Any” (or pick specific deployments)
- This matches only events that include a Deployment resource, which ad‑hoc/subflow runs won’t have
Option B: Flow-run state trigger + Deployment filter
1) Create a new Automation
2) Trigger: “When a flow run enters a state”
3) State: Failed
4) Filters: Choose your Deployment(s) (this restricts to deployment-backed parent runs)
If you prefer a more surgical exclusion of subflows:
- Add an advanced/payload filter to require that the parent indicator is absent, e.g. “flow_run.parent_task_run_id is null” (subflows set this; parent runs do not)
- Or require “flow_run.deployment_id is not null”
Notes
- If you currently rely only on flow name, a subflow failure can match first and satisfy any “once per window” cooldown. Tightening to “has Deployment” (or selecting your specific deployment) prevents that.
- If you’d like, share a screenshot of your Automation config (trigger type, filters/resources, and any cooldown), and I’ll tailor the exact settings for your workspace.
Also, longer term: if/when you move to Prefect 3.x, the same principle applies—filter to deployment-backed runs or explicitly exclude subflows.