Skip to content

Fix CeleryExecutor failing to load with Celery 5.7 - #76591

Merged
eladkal merged 1 commit into
apache:mainfrom
lazerg:fix/celery-5.7-retry-import
Nov 6, 2026
Merged

eladkal merged 1 commit into
apache:mainfrom
lazerg:fix/celery-5.7-retry-import

Conversation

@lazerg

@lazerg lazerg commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Celery 5.7.0 removed the retry decorator from celery.backends.database (celery/celery#10130), so importing celery_executor_utils fails and CeleryExecutor can't load. The provider allows celery<6, so a fresh install picks up 5.7.0.

BulkStateFetcher._query_task_cls_from_db_backend now uses tenacity with the same behavior as Celery's old decorator: up to 3 attempts on the same SQLAlchemy errors, a warning before each retry, and the last error re-raised. This works on every Celery version the provider supports. The integration test that checks the retry log message is updated for tenacity's wording. I checked the import and the BulkStateFetcher DB backend tests on Celery 5.6.3 and 5.7.0.

closes: #76590


Was generative AI tooling used to co-author this PR?
  • Yes (Claude Code, Claude Opus 5.5)

Generated-by: Claude Code (Claude Opus 5.5) following the guidelines


  • 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.

@raphaelauv raphaelauv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just hit the problem in my CI , thanks for the fix

@eladkal
eladkal merged commit 498c1cd into apache:main Nov 6, 2026
72 checks passed
Lee-W added a commit that referenced this pull request Nov 12, 2026
The CI upgrade bumps Celery to 5.7.0, which no longer exports `retry`
from `celery.backends.database`, so importing the Celery executor fails
and breaks core tests, K8S and PROD image e2e runs. Use tenacity's
`retry` instead, as done on main in #76591.
Lee-W added a commit that referenced this pull request Nov 13, 2026
…x is released

Celery 5.7 removed retry from celery.backends.database. The PROD image installs apache-airflow-providers-celery 4.0.0 from PyPI, which predates #76591, so CeleryExecutor fails to import and every PROD e2e and K8S CeleryExecutor job fails. Cap celery below 5.7 until a celery provider release with the fix is available.
Lee-W added a commit that referenced this pull request Nov 13, 2026
* [v3-4-test] CI: Upgrade important CI environment

* [v3-4-test] Fix CeleryExecutor failing to load with Celery 5.7

The CI upgrade bumps Celery to 5.7.0, which no longer exports `retry`
from `celery.backends.database`, so importing the Celery executor fails
and breaks core tests, K8S and PROD image e2e runs. Use tenacity's
`retry` instead, as done on main in #76591.

* [v3-4-test] Keep Celery below 5.7 until a celery provider with the fix is released

Celery 5.7 removed retry from celery.backends.database. The PROD image installs apache-airflow-providers-celery 4.0.0 from PyPI, which predates #76591, so CeleryExecutor fails to import and every PROD e2e and K8S CeleryExecutor job fails. Cap celery below 5.7 until a celery provider release with the fix is available.

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Wei Lee <dev@wei-lee.me>
vatsrahul1001 pushed a commit that referenced this pull request Nov 27, 2026
* [v3-4-test] CI: Upgrade important CI environment

* [v3-4-test] Fix CeleryExecutor failing to load with Celery 5.7

The CI upgrade bumps Celery to 5.7.0, which no longer exports `retry`
from `celery.backends.database`, so importing the Celery executor fails
and breaks core tests, K8S and PROD image e2e runs. Use tenacity's
`retry` instead, as done on main in #76591.

* [v3-4-test] Keep Celery below 5.7 until a celery provider with the fix is released

Celery 5.7 removed retry from celery.backends.database. The PROD image installs apache-airflow-providers-celery 4.0.0 from PyPI, which predates #76591, so CeleryExecutor fails to import and every PROD e2e and K8S CeleryExecutor job fails. Cap celery below 5.7 until a celery provider release with the fix is available.

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Wei Lee <dev@wei-lee.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CeleryExecutor fails to load with Celery 5.7.0: cannot import name 'retry' from 'celery.backends.database'

3 participants