Skip to content

Commit

Permalink
Log provider import errors as debug warnings (#20172)
Browse files Browse the repository at this point in the history
(cherry picked from commit 82102e6)
  • Loading branch information
Aakcht authored and jedcunningham committed Dec 10, 2021
1 parent 3a39702 commit 2ad8c49
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions airflow/providers_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,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",
Expand Down Expand Up @@ -649,16 +659,6 @@ def _import_hook(
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",
Expand Down

0 comments on commit 2ad8c49

Please sign in to comment.