You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/12/08 00:00:38 UTC

[GitHub] [airflow] ashb opened a new pull request #12902: Check that needed (backport) providers are installed

ashb opened a new pull request #12902:
URL: https://github.com/apache/airflow/pull/12902


   It's all very well telling people they need to use a new name, but if
   that results in them getting an ImportError they aren't going to be very
   happy.
   
   It is also aware of backport vs not for the brave souls who might
   upgrade to 2.0.0 _then_ run this
   
   
   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
   In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.md).


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on a change in pull request #12902: Check that needed (backport) providers are installed

Posted by GitBox <gi...@apache.org>.
potiuk commented on a change in pull request #12902:
URL: https://github.com/apache/airflow/pull/12902#discussion_r538548215



##########
File path: airflow/upgrade/rules/import_changes.py
##########
@@ -49,9 +52,20 @@ def old_class(self):
     def new_class(self):
         return self.new_path.split(".")[-1]
 
+    @classmethod
+    def provider_stub_from_module(cls, module):
+        if "providers" not in module:
+            return None
+
+        # [2:] strips off the airflow.providers. part
+        parts = module.split(".")[2:]
+        if parts[0] in ('apache', 'cncf'):

Review comment:
       `setup.PROVIDERS_REQUIREMENTS.keys()`




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on a change in pull request #12902: Check that needed (backport) providers are installed

Posted by GitBox <gi...@apache.org>.
potiuk commented on a change in pull request #12902:
URL: https://github.com/apache/airflow/pull/12902#discussion_r538546241



##########
File path: airflow/upgrade/rules/import_changes.py
##########
@@ -49,9 +52,20 @@ def old_class(self):
     def new_class(self):
         return self.new_path.split(".")[-1]
 
+    @classmethod
+    def provider_stub_from_module(cls, module):
+        if "providers" not in module:
+            return None
+
+        # [2:] strips off the airflow.providers. part
+        parts = module.split(".")[2:]
+        if parts[0] in ('apache', 'cncf'):

Review comment:
       microsoft as well. The easiest way is to check for presence of `provider.yaml` now I think. We also have a list of providers in setup.py (with "." names) and it is verified during pre-commit. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on a change in pull request #12902: Check that needed (backport) providers are installed

Posted by GitBox <gi...@apache.org>.
potiuk commented on a change in pull request #12902:
URL: https://github.com/apache/airflow/pull/12902#discussion_r538552526



##########
File path: airflow/upgrade/rules/import_changes.py
##########
@@ -15,28 +15,31 @@
 # specific language governing permissions and limitations
 # under the License.
 
+import itertools
 from typing import NamedTuple, Optional, List
 
 from cached_property import cached_property
+from packaging.version import Version
 
 from airflow import conf
 from airflow.upgrade.rules.base_rule import BaseRule
 from airflow.upgrade.rules.renamed_classes import ALL
 from airflow.utils.dag_processing import list_py_file_paths
 
+try:
+    from importlib_metadata import PackageNotFoundError, distribution
+except ImportError:
+    from importlib.metadata import PackageNotFoundError, distribution
+
 
 class ImportChange(
     NamedTuple(
         "ImportChange",
-        [("old_path", str), ("new_path", str), ("providers_package", Optional[None])],
+        [("old_path", str), ("new_path", str), ("providers_package", Optional[str])],

Review comment:
       +1




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ashb commented on pull request #12902: Check that needed (backport) providers are installed

Posted by GitBox <gi...@apache.org>.
ashb commented on pull request #12902:
URL: https://github.com/apache/airflow/pull/12902#issuecomment-740256743


   Oh tests are going to fail.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ashb removed a comment on pull request #12902: Check that needed (backport) providers are installed

Posted by GitBox <gi...@apache.org>.
ashb removed a comment on pull request #12902:
URL: https://github.com/apache/airflow/pull/12902#issuecomment-740256743


   Oh tests are going to fail.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ashb commented on a change in pull request #12902: Check that needed (backport) providers are installed

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #12902:
URL: https://github.com/apache/airflow/pull/12902#discussion_r538249150



##########
File path: airflow/upgrade/rules/import_changes.py
##########
@@ -15,28 +15,31 @@
 # specific language governing permissions and limitations
 # under the License.
 
+import itertools
 from typing import NamedTuple, Optional, List
 
 from cached_property import cached_property
+from packaging.version import Version
 
 from airflow import conf
 from airflow.upgrade.rules.base_rule import BaseRule
 from airflow.upgrade.rules.renamed_classes import ALL
 from airflow.utils.dag_processing import list_py_file_paths
 
+try:
+    from importlib_metadata import PackageNotFoundError, distribution
+except ImportError:
+    from importlib.metadata import PackageNotFoundError, distribution
+
 
 class ImportChange(
     NamedTuple(
         "ImportChange",
-        [("old_path", str), ("new_path", str), ("providers_package", Optional[None])],
+        [("old_path", str), ("new_path", str), ("providers_package", Optional[str])],

Review comment:
       Optional[None] doesn't make sense :grin: 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ashb commented on pull request #12902: Check that needed (backport) providers are installed

Posted by GitBox <gi...@apache.org>.
ashb commented on pull request #12902:
URL: https://github.com/apache/airflow/pull/12902#issuecomment-743169379


   Transient failures, merging this.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ashb commented on a change in pull request #12902: Check that needed (backport) providers are installed

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #12902:
URL: https://github.com/apache/airflow/pull/12902#discussion_r538249631



##########
File path: airflow/upgrade/rules/import_changes.py
##########
@@ -49,9 +52,20 @@ def old_class(self):
     def new_class(self):
         return self.new_path.split(".")[-1]
 
+    @classmethod
+    def provider_stub_from_module(cls, module):
+        if "providers" not in module:
+            return None
+
+        # [2:] strips off the airflow.providers. part
+        parts = module.split(".")[2:]
+        if parts[0] in ('apache', 'cncf'):

Review comment:
       I think these are the only two "nested" provider folders we have, so this seemed like an easy way to get the right name for apache-cassandra or cncf-kubernetes etc.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] github-actions[bot] commented on pull request #12902: Check that needed (backport) providers are installed

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #12902:
URL: https://github.com/apache/airflow/pull/12902#issuecomment-740725173


   The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest master at your convenience, or amend the last commit of the PR, and push it with --force-with-lease.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ashb merged pull request #12902: Check that needed (backport) providers are installed

Posted by GitBox <gi...@apache.org>.
ashb merged pull request #12902:
URL: https://github.com/apache/airflow/pull/12902


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ashb commented on a change in pull request #12902: Check that needed (backport) providers are installed

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #12902:
URL: https://github.com/apache/airflow/pull/12902#discussion_r538809736



##########
File path: airflow/upgrade/rules/import_changes.py
##########
@@ -49,9 +52,20 @@ def old_class(self):
     def new_class(self):
         return self.new_path.split(".")[-1]
 
+    @classmethod
+    def provider_stub_from_module(cls, module):
+        if "providers" not in module:
+            return None
+
+        # [2:] strips off the airflow.providers. part
+        parts = module.split(".")[2:]
+        if parts[0] in ('apache', 'cncf'):

Review comment:
       ```suggestion
           if parts[0] in ('apache', 'cncf', 'microsoft'):
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] potiuk commented on a change in pull request #12902: Check that needed (backport) providers are installed

Posted by GitBox <gi...@apache.org>.
potiuk commented on a change in pull request #12902:
URL: https://github.com/apache/airflow/pull/12902#discussion_r538550971



##########
File path: airflow/upgrade/rules/import_changes.py
##########
@@ -49,9 +52,20 @@ def old_class(self):
     def new_class(self):
         return self.new_path.split(".")[-1]
 
+    @classmethod
+    def provider_stub_from_module(cls, module):
+        if "providers" not in module:
+            return None
+
+        # [2:] strips off the airflow.providers. part
+        parts = module.split(".")[2:]
+        if parts[0] in ('apache', 'cncf'):

Review comment:
       Ah. But this is run s part of upgrade check. I see!  It's fine - simply add "microsoft" please.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org