Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trigger gevent monkeypatching via environment variable #28283

Merged
merged 1 commit into from
Dec 21, 2022

Commits on Dec 19, 2022

  1. Trigger gevent monkeypatching via environment variable

    Gevent needs to monkeypatch a number of system libraries as soon
    as possible when Python interpreter starts, in order to avoid
    other libraries monkey-patching them before. We should do it before
    any other initialization and it needs to be only run on webserver.
    
    So far it was done by local_settings monkeypatching but that has
    been rather brittle and some changes in Airflow made previous attempts
    to stop working because the "other" packages could be loaded by
    Airflow before - depending on installed providers and configuration
    (for example when you had AWS configured as logger, boto could have
    been loaded before and it could have monkey patch networking before
    gevent had a chance to do so.
    
    This change introduces different mechanism of triggering the
    patching - it could be triggered by setting an environment variable.
    This has the benefit that we do not need to initialize anything
    (including reading settings or setting up logging) before we determine
    if gevent patching should be performed.
    
    It has also the drawback that the user will have to set the environment
    variable in their deployment manually. However this is a small price to
    pay if they will get a stable and future-proof gevent monkeypatching
    built-in in Airflow.
    
    Fixes: apache#8212
    potiuk committed Dec 19, 2022
    Configuration menu
    Copy the full SHA
    3b122e1 View commit details
    Browse the repository at this point in the history