Skip to content

AIP-97 (3/3): refund the retry attempt for an infra-classified failure (opt-in) - #13

Draft
1fanwang wants to merge 1 commit into
aip97-p2-k8s-bridgefrom
aip97-p3-infra-refund
Draft

AIP-97 (3/3): refund the retry attempt for an infra-classified failure (opt-in)#13
1fanwang wants to merge 1 commit into
aip97-p2-k8s-bridgefrom
aip97-p3-infra-refund

Conversation

@1fanwang

@1fanwang 1fanwang commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Part 3 of 3, on top of 2/3. Consolidated view with in-cluster e2e: apache/airflow#66405.

Why

With the failure classified (1/3, 2/3), an infra disruption should not draw down the retry budget a user set for their own code. is_eligible_to_retry() is try_number <= max_tries, with max_tries = task.retries, so today an eviction spends a real retry.

What

When failure_kind == infra, [core] infra_failure_refund_retries bumps max_tries so the attempt is given back instead of charging retries, capped by [core] max_infra_refunds. The feature is off by default. application, timeout, and manual never refund.

This extends the executor's existing pre-start requeue without a retry to the mid-run case.

Testing

test_taskinstance_infra_refund and test_taskinstance_failure_kind_sources: only infra refunds, the cap holds, and every other cause spends the retry. test_process_executor_events_infra_classification drives the scheduler wiring: unclassified means no refund; infra changes max_tries from 1 to 2. Full in-cluster KubernetesExecutor run in apache/airflow#66405.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ef0af823-718e-4ca6-808d-e837020e427a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch aip97-p3-infra-refund

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…-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>
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