Celery: Ignore redelivered message for already-running task#64052
Open
anishgirianish wants to merge 1 commit intoapache:mainfrom
Open
Celery: Ignore redelivered message for already-running task#64052anishgirianish wants to merge 1 commit intoapache:mainfrom
anishgirianish wants to merge 1 commit intoapache:mainfrom
Conversation
Catch TaskAlreadyRunningError from the supervisor and raise Celery Ignore() to prevent the broker redelivery from being recorded as a task failure. related: apache#58441
Member
|
@anishgirianish This PR has been converted to draft because it does not yet meet our Pull Request quality criteria. Issues found:
What to do next:
Converting a PR to draft is not a rejection — it is an invitation to bring the PR up to the project's standards so that maintainer review time is spent productively. There is no rush — take your time and work at your own pace. We appreciate your contribution and are happy to wait for updates. If you have questions, feel free to ask on the Airflow Slack. |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Catch TaskAlreadyRunningError from the supervisor and raise Celery Ignore() to prevent the broker redelivery from being recorded as a task failure.
related: #58441
Was generative AI tooling used to co-author this PR?
Summary
Catch TaskAlreadyRunningError from the supervisor and raise Celery Ignore() to prevent a broker redelivery from being recorded as a task failure.
In Airflow 3.x, the scheduler processes executor events for RUNNING tasks (not just QUEUED as in 2.x). When Celery redelivers a message for a task that's already running, the worker hits a 409 from the API server. Without this fix, Celery records it as FAILURE, and the scheduler marks the still-running task as failed.
related: #58441
depends on: #60855
{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.