On its own, AIP-97 gives a listener two new arguments and adds a metric
tag, and I'm not sure who that is for.
https://github.com/apache/airflow/issues/28116 has asked since 2022 for the
reason to show on the task instance in the UI, and in
https://github.com/apache/airflow/issues/60858 it was suggested to pass the
failure type to `on_failure_callback`. Neither is in scope here.
https://github.com/apache/airflow/issues/73238 wants retries by cause,
which is AIP-122.

Keeping retries in AIP-122 is fine maybe, but could AIP-97 store the cause
on the try though? There is already a per-try `state_reason` from AIP-105
that the UI renders, so the UI ask is mostly done and AIP-122 wouldn't have
to infer its budget from `max_tries`. The "Self-Healing Retries" thread
from September also wants the next attempt to know why the last one died
(OOM, so retry with more memory).

How would this work for Celery workers on spot nodes? Going by the executor
table, Celery never reports `infra` (a lost worker stays unclassified), so
afaik this only helps KubernetesExecutor and ECS?

On Tue, 1 Dec 2026 at 16:38, Ferruzzi, Dennis via dev <
[email protected]> wrote:

> I like that!
> ________________________________
> From: Amogh Desai via dev <[email protected]>
> Sent: Tuesday, December 1, 2026 7:30 AM
> To: [email protected] <[email protected]>
> Cc: Amogh Desai <[email protected]>
> Subject: [EXT] [DISCUSS] AIP-97: Task Failure Classification
>
> CAUTION: This email originated from outside of the organization. Do not
> click links or open attachments unless you can confirm the sender and know
> the content is safe.
>
>
>
> AVERTISSEMENT: Ce courrier électronique provient d’un expéditeur externe.
> Ne cliquez sur aucun lien et n’ouvrez aucune pièce jointe si vous ne pouvez
> pas confirmer l’identité de l’expéditeur et si vous n’êtes pas certain que
> le contenu ne présente aucun risque.
>
>
>
> Hi all,
>
> I, on behalf of AIP-97 authors  would like to start a discussion on AIP-97:
>
> https://cwiki.apache.org/confluence/spaces/AIRFLOW/pages/399279312/AIP-97+Task+Failure+Classification
>
> *The problem*
> Today, when a task fails, Airflow records that it failed, not why. A Spot
> preemption and a bug in the task can trigger the same alert. The platform
> team can get
> paged for a bug in a Dag, or the Dag author can end up chasing a node
> failure.
>
> The executor often knows the cause of failure, even after the worker is
> gone. For example, Kubernetes marks a preempted pod with `DisruptionTarget`
> and
> KubernetesExecutor already knows that.
>
> *The proposal*
> - Failure listeners and logs can include two optional fields: failure_kind
> (identified in the AIP as infra, application, timeout, manual) and reason.
> Metrics use only the failure category as a tag.
> - infra is set by executors only when the backend can confidently identify
> the cause. Anything unclear stays unclassified.
> - Retries, clears, and callbacks do not change. This AIP only labels
> failures.
> The AIP page has a POC and end-to-end examples.
>
> *How this differs from retry policies*
> A retry policy runs in the worker and decides what to do with an exception
> the task raised. If the worker itself is gone, for example, a preempted
> pod, there is
> no room to capture the exception and no policy runs.
>
> AIP-97 covers that case. It doesn't decide anything - it only records why
> the task stopped.
>
> *Why now*
> We have been working on Airflow’s *durable execution* story and have made
> certain advancements in that domain -
> - Airflow 3.3: When a worker crashes mid-job, the retry reconnects to the
> job that's still running, instead of submitting a duplicate.
> - Airflow 3.5: When the external job itself fails, the retry resumes it
> from where it stopped, for example by repairing a Databricks run so only
> the failed Databricks
> tasks run again.
>
>
> Both of these act on a task after it stops, but neither knows why it
> stopped. Was it a preempted node, a bug in the task, a timeout, or someone
> marking it failed?
> AIP-97 adds that missing piece, so Airflow and the people running it can
> treat each case for what it is.
>
> I'd welcome feedback here or on the AIP.
>
> P.S.: An incarnation / private implementation of this was also presented at
> the Community Over Code in Glasgow this year, and it was well received:
> https://www.youtube.com/watch?v=RJ2AtvJbEO4
>
> Thanks & Regards,
> Amogh Desai
>

Reply via email to