Skip to content

Add TaskGroup-level retries to retry a whole group as a unit - #68139

Closed
yuseok89 wants to merge 5 commits into
apache:mainfrom
yuseok89:add-taskgroup-retries
Closed

yuseok89 wants to merge 5 commits into
apache:mainfrom
yuseok89:add-taskgroup-retries

Conversation

@yuseok89

@yuseok89 yuseok89 commented Jun 6, 2026 •

Copy link
Copy Markdown
Contributor

related: #21867

Implements the minimal v1 scope for TaskGroup retries I proposed on the dev list, a first step toward #21867. A TaskGroup can now be retried as a unit, the way SubDag once could. The richer options from the issue and thread are left for follow-up PRs.

What's in this v1

@task_group(retries=2)        # or: with TaskGroup("g", retries=2): ...
def collect_and_publish():
    publish(collect())
  • When any task in the group fails (after its own task-level retries), the whole group is cleared and re-run, up to retries times; once exhausted the run fails as usual. Default retries=0 keeps today's behavior.
  • Tasks outside the group are untouched (no upstream_failed spill-over) and running siblings are restarted. Nested groups retry innermost-first with independent counters.

Group retries run at the top of DagRun.update_state, before scheduling decisions, so a failure is cleared before it can propagate downstream. Covered by SDK, serialization, and scheduler integration tests.

Out of v1 (follow-ups)
retry_condition (any/last/custom), retry_strategy (all / only-failed), group-level retry_delay, mapped-group retries.

Demo

The example DAG has a collect_and_publish group with retries=2, and publish is intentionally made to fail on its first two attempts and succeed on the third, so the group is retried twice before it goes green. In the run below:

  • collect and publish both run 3 times. A group retry re-runs every task in the group, not just the one that failed.
  • start and finish, which sit outside the group, each run once.
Screen.Recording.2026-06-06.at.11.47.22.PM.mov

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)
    • Opus 4.8

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

Important

🛠️ Maintainer triage note for @yuseok89 · by @potiuk · 2026-07-18 16:36 UTC

I've removed the ready for maintainer review label — the next step here is yours:

  • ❌ Merge conflicts with main. See docs.

It'll return to the maintainer queue automatically once resolved — no need to re-add the label by hand. See the Pull Request quality criteria for details.

The ball is in your court — you've been assigned. Rebase onto main, push, then mark it Ready for review.

Automated triage — may be imperfect; a maintainer takes the next look.

@yuseok89
yuseok89 force-pushed the add-taskgroup-retries branch from bc7581a to ec8660c Compare June 6, 2026 15:54
@yuseok89 yuseok89 changed the title Add TaskGroup-level retries to retry a whole group as a unit (WIP) Add TaskGroup-level retries to retry a whole group as a unit Jun 6, 2026
@yuseok89
yuseok89 force-pushed the add-taskgroup-retries branch from ec8660c to 0177dd1 Compare June 7, 2026 11:47
@yuseok89
yuseok89 marked this pull request as ready for review June 7, 2026 11:47
@yuseok89
yuseok89 force-pushed the add-taskgroup-retries branch from 2cab1bb to 3f81dac Compare June 7, 2026 12:50
@potiuk potiuk added the ready for maintainer review Set after triaging when all criteria pass. label Jun 8, 2026
@yuseok89
yuseok89 force-pushed the add-taskgroup-retries branch from 3f81dac to 636adac Compare June 12, 2026 15:06
@potiuk

potiuk commented Jun 25, 2026

Copy link
Copy Markdown
Member

@yuseok89 — I've removed the ready for maintainer review label because the next step here is yours: this branch now has merge conflicts with main. It'll go back into the maintainer queue automatically once you rebase onto the latest main and push — no need to re-add the label by hand. There's no rush.

Automated triage note drafted by an AI-assisted tool — may get things wrong; a real Apache Airflow maintainer takes the next look once it's green. (why automated)


Drafted-by: Claude Code (Opus 4.8); reviewed by @potiuk before posting

@potiuk potiuk removed the ready for maintainer review Set after triaging when all criteria pass. label Jun 25, 2026
@yuseok89
yuseok89 force-pushed the add-taskgroup-retries branch from 016ad8c to 6bd844f Compare June 25, 2026 14:47
@potiuk potiuk added the ready for maintainer review Set after triaging when all criteria pass. label Jul 2, 2026
@potiuk potiuk removed the ready for maintainer review Set after triaging when all criteria pass. label Jul 18, 2026
@yuseok89
yuseok89 force-pushed the add-taskgroup-retries branch from 6bd844f to 957eb15 Compare July 19, 2026 04:48
Comment thread airflow-core/src/airflow/models/dagrun.py Outdated
@yuseok89
yuseok89 force-pushed the add-taskgroup-retries branch 2 times, most recently from 824a172 to 562418a Compare July 26, 2026 14:29
@potiuk potiuk added the ready for maintainer review Set after triaging when all criteria pass. label Jul 28, 2026
@yuseok89
yuseok89 force-pushed the add-taskgroup-retries branch 2 times, most recently from fb20e44 to 2d7a20a Compare August 11, 2026 12:29
@yuseok89
yuseok89 force-pushed the add-taskgroup-retries branch from 2d7a20a to 6d68027 Compare August 18, 2026 13:12
@potiuk potiuk added the closed because of open PR limit Closed as a one-time step of introducing the open pull request limit label Sep 25, 2026
@potiuk

potiuk commented Sep 25, 2026

Copy link
Copy Markdown
Member

Hello @yuseok89 - thank you for your contributions to Apache Airflow!

The Airflow community has introduced a limit of 5 open pull requests at a time for contributors without write access to the repository. You currently have 11 open pull requests, so - as a one-time step of introducing the limit - we closed the ones where maintainers have not engaged yet:

These pull requests stay open because maintainers are already engaged in them - they count towards your limit:

This is not a judgement of you or of your changes. We never told contributors before that opening many pull requests at once was a problem, so there is nothing to feel bad about - and nothing is lost: your branches, commits and the review history stay where they are.

What we ask you to do is to make your first prioritization decision: choose which of the pull requests above matter most to you, and reopen them (up to 5 open at a time, including the ones still open) with the "Reopen pull request" button or gh pr reopen <PR_NUMBER> --repo apache/airflow. Reopen the ones you are ready to follow through - keep them rebased, respond to review comments and fix failing checks.

While your pull requests are waiting for review, the most valuable thing you can do is help in other ways - reviewing other contributors' pull requests, helping with issues, and taking part in the discussions on the devlist and Slack.

Why we introduced the limit, what it means for you and how to reopen or restore a pull request is explained in https://github.com/apache/airflow/blob/main/contributing-docs/32_open_pull_request_limit.rst.


Drafted-by: Claude Code (Opus 5); reviewed by @potiuk before posting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:dag-processor area:db-migrations PRs with DB migration area:task-sdk closed because of open PR limit Closed as a one-time step of introducing the open pull request limit kind:documentation ready for maintainer review Set after triaging when all criteria pass.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants