Skip to content

Commit 3fad890

Browse files
committed
Fix dependencies for celery and opentelemetry for Python 3.8 (#33579)
We used to have problems with `pip` backtracking when we relaxed too much open-telemetry dependencies. It turned out that the backtracting was only happening on Python 3.8 and that it was ultimately caused by conflict between importlib_metadata between Airflow and newer versions of opentelemetry (we had <5 for Python 3.8, they had >6 for all versions. The reason for limiting it in Airflow was Celery that was not working well with importlib 5. Since Celery 5.3 solved the problems (released 6th of June) we can now relax the importlib_metadata limit and set Celery to version >= 5.3.0) which nicely resolves the conflict and there is no more backtracking when trying to install newer versions of opentelemetry for Python 3.8. Fixes: #33577 (cherry picked from commit ae25a52)
1 parent 698ad80 commit 3fad890

File tree

5 files changed

+6
-10
lines changed

5 files changed

+6
-10
lines changed

airflow/providers/celery/provider.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ dependencies:
4343
# Uses Celery for CeleryExecutor, and we also know that Kubernetes Python client follows SemVer
4444
# (https://docs.celeryq.dev/en/stable/contributing.html?highlight=semver#versions).
4545
# Make sure that the limit here is synchronized with [celery] extra in the airflow core
46-
- celery>=5.2.3,<6
46+
- celery>=5.3.0,<6
4747
- flower>=1.0.0
4848

4949
integrations:

dev/breeze/src/airflow_breeze/utils/path_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def get_package_setup_metadata_hash() -> str:
8787
try:
8888
from importlib.metadata import distribution # type: ignore[attr-defined]
8989
except ImportError:
90-
from importlib_metadata import distribution # type: ignore[no-redef]
90+
from importlib_metadata import distribution # type: ignore[no-redef, assignment]
9191

9292
prefix = "Package config hash: "
9393

generated/provider_dependencies.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@
244244
"celery": {
245245
"deps": [
246246
"apache-airflow>=2.4.0",
247-
"celery>=5.2.3,<6",
247+
"celery>=5.3.0,<6",
248248
"flower>=1.0.0"
249249
],
250250
"cross-providers-deps": [

setup.cfg

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,7 @@ install_requires =
102102
graphviz>=0.12
103103
gunicorn>=20.1.0
104104
httpx
105-
# Importlib-metadata 5 is breaking Celery import due to regression it introduced
106-
# This was tracked and fixed in https://github.com/celery/celery/pull/7785 but it is not released yet
107-
# We can remove the < 5.0.0 limitation when Celery 5.3.0 gets released and we bump celery to >= 5.3.0
108-
importlib_metadata>=1.7,<5.0.0;python_version<"3.9"
105+
importlib_metadata>=1.7;python_version<"3.9"
109106
importlib_resources>=5.2;python_version<"3.9"
110107
itsdangerous>=2.0
111108
jinja2>=3.0.0
@@ -118,8 +115,7 @@ install_requires =
118115
markupsafe>=1.1.1
119116
marshmallow-oneofschema>=2.0.1
120117
mdit-py-plugins>=0.3.0
121-
# Pip can not find a version that satisfies constraints if opentelemetry-api is not pinned.
122-
opentelemetry-api==1.15.0
118+
opentelemetry-api>=1.15.0
123119
opentelemetry-exporter-otlp
124120
packaging>=14.0
125121
pathspec>=0.9.0

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ def write_version(filename: str = str(AIRFLOW_SOURCES_ROOT / "airflow" / "git_ve
275275
# limiting minimum airflow version supported in celery provider due to the
276276
# potential breaking changes in Airflow Core as well (celery is added as extra, so Airflow
277277
# core is not hard-limited via install-requires, only by extra).
278-
"celery>=5.2.3,<6"
278+
"celery>=5.3.0,<6"
279279
]
280280
cgroups = [
281281
# Cgroupspy 0.2.2 added Python 3.10 compatibility

0 commit comments

Comments
 (0)