You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2021/12/09 21:34:15 UTC

[airflow] branch main updated: Log provider import errors as debug warnings (#20172)

This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new 82102e6  Log provider import errors as debug warnings (#20172)
82102e6 is described below

commit 82102e656b10b12d7b93af2dfc9dd1de2a4ce708
Author: Aakcht <aa...@gmail.com>
AuthorDate: Fri Dec 10 00:33:31 2021 +0300

    Log provider import errors as debug warnings (#20172)
---
 airflow/providers_manager.py | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/airflow/providers_manager.py b/airflow/providers_manager.py
index 7b47a9a..487d1cf 100644
--- a/airflow/providers_manager.py
+++ b/airflow/providers_manager.py
@@ -140,6 +140,16 @@ def _sanity_check(provider_package: str, class_name: str) -> bool:
         return False
     try:
         import_string(class_name)
+    except ImportError as e:
+        # When there is an ImportError we turn it into debug warnings as this is
+        # an expected case when only some providers are installed
+        log.debug(
+            "Exception when importing '%s' from '%s' package: %s",
+            class_name,
+            provider_package,
+            e,
+        )
+        return False
     except Exception as e:
         log.warning(
             "Exception when importing '%s' from '%s' package: %s",
@@ -642,16 +652,6 @@ class ProvidersManager(LoggingMixin):
                 field_behaviours = hook_class.get_ui_field_behaviour()
                 if field_behaviours:
                     self._add_customized_fields(package_name, hook_class, field_behaviours)
-        except ImportError as e:
-            # When there is an ImportError we turn it into debug warnings as this is
-            # an expected case when only some providers are installed
-            log.debug(
-                "Exception when importing '%s' from '%s' package: %s",
-                hook_class_name,
-                package_name,
-                e,
-            )
-            return None
         except Exception as e:
             log.warning(
                 "Exception when importing '%s' from '%s' package: %s",