-
Notifications
You must be signed in to change notification settings - Fork 14.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update our approach for executor-bound dependencies #22573
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
27 changes: 27 additions & 0 deletions
27
scripts/ci/provider_packages/ci_make_providers_2_1_compliant.sh
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env bash | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# shellcheck source=scripts/ci/libraries/_script_init.sh | ||
. "$( dirname "${BASH_SOURCE[0]}" )/../libraries/_script_init.sh" | ||
|
||
# Some of our provider sources are not Airflow 2.1 compliant any more | ||
# We replace them with 2.1 compliant versions from PyPI to run the checks | ||
|
||
cd "${AIRFLOW_SOURCES}" || exit 1 | ||
rm -rvf dist/apache_airflow_providers_cncf_kubernetes* dist/apache_airflow_providers_celery* | ||
pip download --no-deps --dest dist apache-airflow-providers-cncf-kubernetes==3.0.0 \ | ||
apache-airflow-providers-celery==2.1.3 |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -235,7 +235,16 @@ def write_version(filename: str = os.path.join(*[my_dir, "airflow", "git_version | |||||
'cassandra-driver>=3.13.0', | ||||||
] | ||||||
celery = [ | ||||||
'celery>=5.2.3', | ||||||
# The Celery is known to introduce problems when upgraded to a MAJOR version. Airflow Core | ||||||
# Uses Celery for CeleryExecutor, and we also know that Kubernetes Python client follows SemVer | ||||||
# (https://docs.celeryq.dev/en/stable/contributing.html?highlight=semver#versions). | ||||||
# This is a crucial component of Airflow, so we should limit it to the next MAJOR version and only | ||||||
# deliberately bump the version when we tested it, and we know it can be bumped. | ||||||
# Bumping this version should also be connected with | ||||||
# limiting minimum airflow version supported in cncf.kubernetes provider, due to the | ||||||
# potential breaking changes in Airflow Core as well (celery is added as extra, so Airflow | ||||||
# core is not hard-limited via install-requirements, only by extra). | ||||||
'celery>=5.2.3,<6', | ||||||
'flower>=1.0.0', | ||||||
] | ||||||
cgroups = [ # type:ignore | ||||||
|
@@ -419,7 +428,15 @@ def write_version(filename: str = os.path.join(*[my_dir, "airflow", "git_version | |||||
] | ||||||
kubernetes = [ | ||||||
'cryptography>=2.0.0', | ||||||
'kubernetes>=21.7.0', | ||||||
# The Kubernetes API is known to introduce problems when upgraded to a MAJOR version. Airflow Core | ||||||
# Uses Kubernetes for Kubernetes executor, and we also know that Kubernetes Python client follows SemVer | ||||||
# (https://github.com/kubernetes-client/python#compatibility). This is a crucial component of Airflow | ||||||
# So we should limit it to the next MAJOR version and only deliberately bump the version when we | ||||||
# tested it, and we know it can be bumped. Bumping this version should also be connected with | ||||||
# limiting minimum airflow version supported in cncf.kubernetes provider, due to the | ||||||
# potential breaking changes in Airflow Core as well (kubernetes is added as extra, so Airflow | ||||||
# core is not hard-limited via install-requirements, only by extra). | ||||||
'kubernetes>=21.7.0,<24', | ||||||
] | ||||||
kylin = ['kylinpy>=2.6'] | ||||||
ldap = [ | ||||||
|
@@ -745,7 +762,7 @@ def write_version(filename: str = os.path.join(*[my_dir, "airflow", "git_version | |||||
# To airflow core. They do not have separate providers because they do not have any operators/hooks etc. | ||||||
CORE_EXTRAS_REQUIREMENTS: Dict[str, List[str]] = { | ||||||
'async': async_packages, | ||||||
'celery': celery, # also has provider, but it extends the core with the Celery executor | ||||||
'celery': celery, # also has provider, but it extends the core with the CeleryExecutor | ||||||
'cgroups': cgroups, | ||||||
'cncf.kubernetes': kubernetes, # also has provider, but it extends the core with the KubernetesExecutor | ||||||
'dask': dask, | ||||||
|
@@ -1033,17 +1050,29 @@ def replace_extra_requirement_with_provider_packages(extra: str, providers: List | |||||
['simple-salesforce>=1.0.0', 'tableauserverclient'] | ||||||
|
||||||
So transitively 'salesforce' extra has all the requirements it needs and in case the provider | ||||||
changes it's dependencies, they will transitively change as well. | ||||||
changes its dependencies, they will transitively change as well. | ||||||
|
||||||
In the constraint mechanism we save both - provider versions and it's dependencies | ||||||
version, which means that installation using constraints is repeatable. | ||||||
|
||||||
For K8s, Celery which are both "Core executors" and "Providers" we have to | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
add the base dependencies to the core as well - in order to mitigate problems where | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
newer version of provider will have less strict limits. This should be done for both | ||||||
extras and their deprecated aliases. This is not a full protection however, the way | ||||||
extras work, this will not add "hard" limits for Airflow and the user who does not use | ||||||
constraints | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
:param extra: Name of the extra to add providers to | ||||||
:param providers: list of provider ids | ||||||
""" | ||||||
EXTRAS_REQUIREMENTS[extra] = [ | ||||||
get_provider_package_from_package_id(package_name) for package_name in providers | ||||||
] | ||||||
if extra in ['cncf.kubernetes', 'kubernetes', 'celery']: | ||||||
potiuk marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
EXTRAS_REQUIREMENTS[extra].extend( | ||||||
[get_provider_package_from_package_id(package_name) for package_name in providers] | ||||||
) | ||||||
else: | ||||||
EXTRAS_REQUIREMENTS[extra] = [ | ||||||
get_provider_package_from_package_id(package_name) for package_name in providers | ||||||
] | ||||||
|
||||||
|
||||||
def add_provider_packages_to_extra_requirements(extra: str, providers: List[str]) -> None: | ||||||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed (it just makes constraint generation longer - we already have the images pulled at this stage)