Skip to content

from 'apache-airflow-providers-google' package: No module named 'airflow.providers.postgres' #14286

Closed

Description

Apache Airflow version: 2.0.1

Environment:

  • Cloud provider or hardware configuration: MacBook Pro
  • OS (e.g. from /etc/os-release): Catalina 10.15.7
  • Kernel (e.g. uname -a): Darwin CSchillebeeckx-0589.local 19.6.0 Darwin Kernel Version 19.6.0: Thu Oct 29 22:56:45 PDT 2020; root:xnu-6153.141.2.2~1/RELEASE_X86_64 x86_64
  • Install tools: pip

requirements.txt

apache-airflow[crypto,celery,amazon,mysql,jdbc,password,redis,slack,snowflake,ssh,google,databricks,mongo,zendesk,papermill,salesforce]==2.0.1
pyarrow==0.17.1
iniconfig==1.1.1
sqlparse==0.4.1
google-api-python-client===1.12.8
google-auth==1.27.0
google-api-core==1.26.0
avro-python3==1.10.0
databricks-connect==7.3.8
matplotlib==3.3.4
scikit-learn==0.24.1
ipykernel==5.4.3
flower==0.9.7

What happened:

I'm using MySQL as a backend and am using the GoogleBaseHook; when I run the webserver I see:

webserver_1  | [2021-02-16 23:39:13,008] {providers_manager.py:299} WARNING - Exception when importing 'airflow.providers.google.cloud.hooks.cloud_sql.CloudSQLHook' from 'apache-airflow-providers-google' package: No module named 'airflow.providers.postgres'
webserver_1  | [2021-02-16 23:39:13,009] {providers_manager.py:299} WARNING - Exception when importing 'airflow.providers.google.cloud.hooks.cloud_sql.CloudSQLDatabaseHook' from 'apache-airflow-providers-google' package: No module named 'airflow.providers.postgres'
webserver_1  | [2021-02-16 23:39:13,066] {providers_manager.py:299} WARNING - Exception when importing 'airflow.providers.google.cloud.hooks.cloud_sql.CloudSQLHook' from 'apache-airflow-providers-google' package: No module named 'airflow.providers.postgres'
webserver_1  | [2021-02-16 23:39:13,067] {providers_manager.py:299} WARNING - Exception when importing 'airflow.providers.google.cloud.hooks.cloud_sql.CloudSQLDatabaseHook' from 'apache-airflow-providers-google' package: No module named 'airflow.providers.postgres'

If I add the extra package postgres the warnings are not present anymore.

What you expected to happen:

No warnings

How to reproduce it:

Anything else we need to know:

Activity

  1. boring-cyborg commented on Feb 17, 2021

    @boring-cyborg

    Thanks for opening your first issue here! Be sure to follow the issue template!

  2. self-assigned this
    on Feb 17, 2021
  3. added this to the Airflow 2.0.2 milestone on Feb 17, 2021
  4. potiuk commented on Feb 17, 2021

    @potiuk
    Member

    Yep. We could remove the warnings indeed.

  5. added
    priority:lowBug with a simple workaround that would not block a release
    on Feb 17, 2021
  6. removed their assignment
    on Feb 17, 2021
  7. OBITORASU commented on Feb 18, 2021

    @OBITORASU

    Can I work on this particular issue? I am assuming addding postgres to the apache-airflow[crypto,celery,amazon,mysql,jdbc,password,redis,slack,snowflake,ssh,google,databricks,mongo,zendesk,papermill,salesforce]==2.0.1 line should cover the warnings (correct me if I am wrong).

  8. potiuk commented on Feb 18, 2021

    @potiuk
    Member

    Sure. Feel free. I think the gist is that we should log those warnings at info level not warning :)

  9. potiuk commented on Feb 18, 2021

    @potiuk
    Member

    Those warnings here are not really warnings - they will happen if you do not have all providers installed, but they should not be treated as warnings, this is expected behaviour, so it should be INFO.

  10. OBITORASU commented on Feb 18, 2021

    @OBITORASU

    Checking the error log and your suggestions above, should my approach be to introduce changes to providers_manager.py file and change the log.warning to log.info on line 295 to fix this issue? Hoping to hear back from you, thanks for your time and patience!

  11. ConstantinoSchillebeeckx commented on Feb 18, 2021

    @ConstantinoSchillebeeckx
    ContributorAuthor

    Even at INFO, isn't this going to be really chatty? I think the webserver will just keep emitting those statements; I don't know this codebase well at all, but wouldn't a better fix be not to emit that message if it's not needed?

  12. potiuk commented on Feb 18, 2021

    @potiuk
    Member

    This should be a one-time only message per webserver process only at the start of the process. Do you see it more often/repeated @ConstantinoSchillebeeckx ?

  13. 16 remaining items

  14. removed their assignment
    on Mar 19, 2021
  15. ConstantinoSchillebeeckx commented on Mar 19, 2021

    @ConstantinoSchillebeeckx
    ContributorAuthor

    I can pick this up if no one minds; if someone can nudge me in the right direction that would be great.

  16. potiuk commented on Mar 19, 2021

    @potiuk
    Member

    @ConstantinoSchillebeeckx - I think the main task is to diagnose it to see what is really the issue here. I expected that those warnings will only be printed once (which would be acceptable) but seems in the webserver they continue spamming the logs - I will have time to take a look tomorrow, but if you want, you can pick it before.

  17. ashb commented on Mar 19, 2021

    @ashb
    Member

    @ConstantinoSchillebeeckx - I think the main task is to diagnose it to see what is really the issue here. I expected that those warnings will only be printed once (which would be acceptable) but seems in the webserver they continue spamming the logs - I will have time to take a look tomorrow, but if you want, you can pick it before.

    On webserver boot up, the app is loaded once before starting gunicorn, then again for each of the (by default 4) workers, and then by default one webserver worker is replaced every 30s. Each time a web process starts up it will load the providers and produce these logs.

  18. potiuk commented on Mar 19, 2021

    @potiuk
    Member

    Yep. Makes sense. Just started looking at it :)

  19. potiuk commented on Mar 19, 2021

    @potiuk
    Member

    Yep. Just reproduced it. The warnings come every 30 s

  20. potiuk commented on Mar 19, 2021

    @potiuk
    Member
  21. added a commit that references this issue on Mar 20, 2021
    2f32df7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

good first issuekind:bugThis is a clearly a bugpriority:lowBug with a simple workaround that would not block a release

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions