Skip to content

AIP-97 POC (open q): drop infra_reason column, deliver the token via error - #22

Open
1fanwang wants to merge 4 commits into
1fanwang/aip97-failure-detailsfrom
aip97-nodb-error
Open

AIP-97 POC (open q): drop infra_reason column, deliver the token via error#22
1fanwang wants to merge 4 commits into
1fanwang/aip97-failure-detailsfrom
aip97-nodb-error

Conversation

@1fanwang

@1fanwang 1fanwang commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Problem & Solution Overview

Open-question POC: after dropping the infra_reason column, how should the executor's reason token reach the listener?

This variant folds the token into the existing error argument. An infra failure with no worker error reaches the listener as, for example, error="Evicted" with failure_kind=infra. That keeps the hook surface unchanged.

Trade-off: error becomes a short token for infra failures but a full exception for application failures, so consumers cannot treat it as one uniform shape.

Sibling POC, dedicated reason argument: #23
Both variants are alternatives to the column design in apache#66405.

Testing Done

Shares the verified no-column core with the reason POC: real DB, real registered listener, real scheduler failure path, no infra_reason column, transient token delivery, and the retry refunded. The only difference is that this variant sends the token through error instead of a separate argument.

1fanwang added 4 commits July 27, 2026 12:23
…column

on_task_instance_failed gains an optional failure_kind argument, a
TaskFailureKind str enum (infra / application / timeout / manual) in
airflow_shared.state. pluggy dispatches by parameter name, so a listener that
does not declare it keeps working. The worker populates application or timeout;
a manual mark-failed populates manual. The executor's reason token persists on
the task instance as a new nullable infra_reason column.

Foundation for AIP-97; the Kubernetes classifier (infra) and the opt-in retry
refund follow as separate PRs.

Signed-off-by: 1fanwang <1fannnw@gmail.com>
…he scheduler

The Kubernetes executor's classify_pod_failure() maps a node-level disruption
(Evicted, Preempting, DisruptionTarget, node shutdown) or a pod removed while
its task is running (PodDeleted — drain, preemption, spot reclaim, force-delete)
to failure_kind=infra; a container that ended on its own (an app crash, an OOM
against its own limit) to application. The classification rides a side channel on
BaseExecutor that the scheduler reads once and passes to the listener with the
executor's reason token. An unclassified death stays None, so the scheduler stays
conservative and never guesses infra.

Builds on the failure_kind foundation; the opt-in retry refund follows.

Signed-off-by: 1fanwang <1fannnw@gmail.com>
…-in)

When failure_kind is infra, [core] infra_failure_refund_retries bumps max_tries
so the attempt is given back instead of drawing on the user's retries, bounded by
[core] max_infra_refunds. Off by default; application, timeout, and manual
failures never refund. This extends the Kubernetes executor's existing behavior —
a pod that dies before the task starts is already requeued without consuming a
retry — to the mid-execution case, now that the failure is classified.

Completes the AIP-97 foundation stack.

Signed-off-by: 1fanwang <1fannnw@gmail.com>
Remove the infra_reason column + migration. The executor still produces the
(failure_kind, reason) token; the scheduler hands the token to the listener as
the failure's error instead of persisting it, so an infra failure that left no
worker error now surfaces e.g. error='Evicted' with failure_kind=infra. No
schema change, no new hook argument.

Signed-off-by: 1fanwang <1fannnw@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant