ianbuss opened a new issue, #23823:
URL: https://github.com/apache/airflow/issues/23823

   ### Apache Airflow version
   
   2.3.0 (latest released)
   
   ### What happened
   
   The `providers_manager.py` logs an import warning with stack trace (see 
example) for optional provider features instead of an info message noting the 
optional feature is disabled. Sample message:
   ```
   [2022-05-19 21:46:53,065] {providers_manager.py:223} WARNING - Exception 
when importing 
'airflow.providers.google.cloud.hooks.compute_ssh.ComputeEngineSSHHook' from 
'apache-airflow-providers-google' package
   Traceback (most recent call last):
     File 
"/usr/local/lib/python3.9/site-packages/airflow/providers_manager.py", line 
257, in _sanity_check
       imported_class = import_string(class_name)
     File 
"/usr/local/lib/python3.9/site-packages/airflow/utils/module_loading.py", line 
32, in import_string
       module = import_module(module_path)
     File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in 
import_module
       return _bootstrap._gcd_import(name[level:], package, level)
     File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
     File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
     File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
     File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
     File "<frozen importlib._bootstrap_external>", line 850, in exec_module
     File "<frozen importlib._bootstrap>", line 228, in 
_call_with_frames_removed
     File 
"/usr/local/lib/python3.9/site-packages/airflow/providers/google/cloud/hooks/compute_ssh.py",
 line 23, in <module>
       import paramiko
   ModuleNotFoundError: No module named 'paramiko'
   ```
   
   ### What you think should happen instead
   
   There is explicit code for catching `ModuleNotFoundException`s so these 
import errors should be logged as info messages like:
   ```
   [2022-05-20 08:18:54,680] {providers_manager.py:215} INFO - Optional 
provider feature disabled when importing 
'airflow.providers.google.cloud.hooks.compute_ssh.ComputeEngineSSHHook' from 
'apache-airflow-providers-google' package
   ```
   
   ### How to reproduce
   
   Install the `google` provider but do not install the `ssh` submodule (or 
alternatively the `mysql` module). Various airflow components will produce the 
above warning logs.
   
   ### Operating System
   
   Debian bullseye
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Other Docker-based deployment
   
   ### Deployment details
   
   _No response_
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to