Beispiel #1
0
def _integrate_plugins():
    """Integrate plugins to the context"""
    from airflow.plugins_manager import hooks_modules
    for hooks_module in hooks_modules:
        sys.modules[hooks_module.__name__] = hooks_module

        if not PY37:
            from pep562 import Pep562
            hooks_module = Pep562(hooks_module.__name__)
        globals()[hooks_module._name] = hooks_module

        ##########################################################
        # TODO FIXME Remove in Airflow 2.0

        if not _os.environ.get('AIRFLOW_USE_NEW_IMPORTS', False):
            from zope.deprecation import deprecated as _deprecated
            for _hook in hooks_module._objects:
                hook_name = _hook.__name__
                globals()[hook_name] = _hook
                _deprecated(
                    hook_name,
                    "Importing plugin hook '{i}' directly from "
                    "'airflow.hooks' has been deprecated. Please "
                    "import from 'airflow.hooks.[plugin_module]' "
                    "instead. Support for direct imports will be dropped "
                    "entirely in Airflow 2.0.".format(i=hook_name))
Beispiel #2
0
def _integrate_plugins():
    """Integrate plugins to the context"""
    from airflow.plugins_manager import hooks_modules
    for hooks_module in hooks_modules:
        sys.modules[hooks_module.__name__] = hooks_module
        globals()[hooks_module._name] = hooks_module

        ##########################################################
        # TODO FIXME Remove in Airflow 2.0

        if not _os.environ.get('AIRFLOW_USE_NEW_IMPORTS', False):
            from zope.deprecation import deprecated as _deprecated
            for _hook in hooks_module._objects:
                hook_name = _hook.__name__
                globals()[hook_name] = _hook
                _deprecated(
                    hook_name,
                    "Importing plugin hook '{i}' directly from "
                    "'airflow.hooks' has been deprecated. Please "
                    "import from 'airflow.hooks.[plugin_module]' "
                    "instead. Support for direct imports will be dropped "
                    "entirely in Airflow 2.0.".format(i=hook_name))
Beispiel #3
0
def _integrate_plugins():
    """Integrate plugins to the context"""
    from airflow.plugins_manager import sensors_modules
    for sensors_module in sensors_modules:
        sys.modules[sensors_module.__name__] = sensors_module
        globals()[sensors_module._name] = sensors_module

        ##########################################################
        # TODO FIXME Remove in Airflow 2.0

        if not _os.environ.get('AIRFLOW_USE_NEW_IMPORTS', False):
            from zope.deprecation import deprecated as _deprecated
            for _sensor in sensors_module._objects:
                sensor_name = _sensor.__name__
                globals()[sensor_name] = _sensor
                _deprecated(
                    sensor_name,
                    "Importing plugin operator '{i}' directly from "
                    "'airflow.operators' has been deprecated. Please "
                    "import from 'airflow.operators.[plugin_module]' "
                    "instead. Support for direct imports will be dropped "
                    "entirely in Airflow 2.0.".format(i=sensor_name))
Beispiel #4
0
def _integrate_plugins():
    """Integrate plugins to the context"""
    from airflow.plugins_manager import operators as _operators
    for _operator_module in _operators:
        sys.modules[_operator_module.__name__] = _operator_module
        globals()[_operator_module._name] = _operator_module

        ##########################################################
        # TODO FIXME Remove in Airflow 2.0

        if not _os.environ.get('AIRFLOW_USE_NEW_IMPORTS', False):
            from zope.deprecation import deprecated as _deprecated
            for _operator in _operator_module._objects:
                globals()[_operator.__name__] = _deprecated(
                    _operator,
                    "Importing plugin operator '{i}' directly from "
                    "'airflow.operators' has been deprecated. Please "
                    "import from 'airflow.operators.[plugin_module]' "
                    "instead. Support for direct imports will be dropped "
                    "entirely in Airflow 2.0.".format(i=_operator))
def _integrate_plugins():
    """Integrate plugins to the context"""
    import sys
    from airflow.plugins_manager import macros as _macros
    for _macro_module in _macros:
        sys.modules[_macro_module.__name__] = _macro_module
        globals()[_macro_module._name] = _macro_module

        ##########################################################
        # TODO FIXME Remove in Airflow 2.0

        import os as _os
        if not _os.environ.get('AIRFLOW_USE_NEW_IMPORTS', False):
            from zope.deprecation import deprecated as _deprecated
            for _macro in _macro_module._objects:
                globals()[_macro.__name__] = _deprecated(
                    _macro, "Importing plugin macro '{i}' directly from "
                    "'airflow.macros' has been deprecated. Please "
                    "import from 'airflow.macros.[plugin_module]' "
                    "instead. Support for direct imports will be dropped "
                    "entirely in Airflow 2.0.".format(i=_macro))
Beispiel #6
0
        log.info('Creating new FAB webserver config file in: %s',
                 WEBSERVER_CONFIG)
        with open(WEBSERVER_CONFIG, 'w') as f:
            f.write(DEFAULT_WEBSERVER_CONFIG)

if conf.getboolean('core', 'unit_test_mode'):
    conf.load_test_config()

# Historical convenience functions to access config entries

load_test_config = conf.load_test_config
get = conf.get
getboolean = conf.getboolean
getfloat = conf.getfloat
getint = conf.getint
getsection = conf.getsection
has_option = conf.has_option
remove_option = conf.remove_option
as_dict = conf.as_dict
set = conf.set  # noqa

for func in [
        load_test_config, get, getboolean, getfloat, getint, has_option,
        remove_option, as_dict, set
]:
    _deprecated(
        func, "Accessing configuration method '{f.__name__}' directly from "
        "the configuration module is deprecated. Please access the "
        "configuration from the 'configuration.conf' object via "
        "'conf.{f.__name__}'".format(f=func))
Beispiel #7
0
    'jdbc_operator': ['JdbcOperator'],
    'mssql_operator': ['MsSqlOperator'],
    'mssql_to_hive': ['MsSqlToHiveTransfer'],
    'slack_operator': ['SlackAPIOperator', 'SlackAPIPostOperator'],
    'generic_transfer': ['GenericTransfer'],
    'oracle_operator': ['OracleOperator']
}

import os as _os
if not _os.environ.get('AIRFLOW_USE_NEW_IMPORTS', False):
    from zope.deprecation import deprecated as _deprecated
    _imported = _import_module_attrs(globals(), _operators)
    for _i in _imported:
        _deprecated(
            _i,
            "Importing {i} directly from 'airflow.operators' has been "
            "deprecated. Please import from "
            "'airflow.operators.[operator_module]' instead. Support for direct "
            "imports will be dropped entirely in Airflow 2.0.".format(i=_i))


def _integrate_plugins():
    """Integrate plugins to the context"""
    import sys
    from airflow.plugins_manager import operators as _operators
    for _operator_module in _operators:
        sys.modules[_operator_module.__name__] = _operator_module
        globals()[_operator_module._name] = _operator_module


        ##########################################################
        # TODO FIXME Remove in Airflow 2.0
Beispiel #8
0
    'druid_hook': ['DruidHook'],
    'jdbc_hook': ['JdbcHook'],
    'dbapi_hook': ['DbApiHook'],
    'mssql_hook': ['MsSqlHook'],
    'oracle_hook': ['OracleHook'],
}


import os as _os
if not _os.environ.get('AIRFLOW_USE_NEW_IMPORTS', False):
    from zope.deprecation import deprecated as _deprecated
    _imported = _import_module_attrs(globals(), _hooks)
    for _i in _imported:
        _deprecated(
            _i,
            "Importing {i} directly from 'airflow.hooks' has been "
            "deprecated. Please import from "
            "'airflow.hooks.[hook_module]' instead. Support for direct imports "
            "will be dropped entirely in Airflow 2.0.".format(i=_i))


def _integrate_plugins():
    """Integrate plugins to the context"""
    import sys
    from airflow.plugins_manager import hooks as _hooks
    for _hook_module in _hooks:
        sys.modules[_hook_module.__name__] = _hook_module
        globals()[_hook_module._name] = _hook_module


        ##########################################################
        # TODO FIXME Remove in Airflow 2.0
Beispiel #9
0
# ------------------------------------------------------------------------

# Imports the hooks dynamically while keeping the package API clean,
# abstracting the underlying modules
from airflow.utils.helpers import import_module_attrs as _import_module_attrs

_hooks = {
    'ftp_hook': ['FTPHook'],
    'ftps_hook': ['FTPSHook'],
    'vertica_hook': ['VerticaHook'],
    'ssh_hook': ['SSHHook'],
    'bigquery_hook': ['BigQueryHook'],
    'qubole_hook': ['QuboleHook'],
    'gcs_hook': ['GoogleCloudStorageHook'],
    'datastore_hook': ['DatastoreHook'],
    'gcp_dataproc_hook': ['DataProcHook'],
    'cloudant_hook': ['CloudantHook'],
    'fs_hook': ['FSHook']
}

import os as _os
if not _os.environ.get('AIRFLOW_USE_NEW_IMPORTS', False):
    from zope.deprecation import deprecated as _deprecated
    _imported = _import_module_attrs(globals(), _hooks)
    for _i in _imported:
        _deprecated(
            _i, "Importing {i} directly from 'contrib.hooks' has been "
            "deprecated. Please import from "
            "'contrib.hooks.[hook_module]' instead. Support for direct imports "
            "will be dropped entirely in Airflow 2.0.".format(i=_i))
    if not os.path.isfile(WEBSERVER_CONFIG):
        log.info('Creating new FAB webserver config file in: %s', WEBSERVER_CONFIG)
        with open(WEBSERVER_CONFIG, 'w') as f:
            f.write(DEFAULT_WEBSERVER_CONFIG)

if conf.getboolean('core', 'unit_test_mode'):
    conf.load_test_config()

# Historical convenience functions to access config entries

load_test_config = conf.load_test_config
get = conf.get
getboolean = conf.getboolean
getfloat = conf.getfloat
getint = conf.getint
getsection = conf.getsection
has_option = conf.has_option
remove_option = conf.remove_option
as_dict = conf.as_dict
set = conf.set # noqa

for func in [load_test_config, get, getboolean, getfloat, getint, has_option,
             remove_option, as_dict, set]:
    _deprecated(
        func,
        "Accessing configuration method '{f.__name__}' directly from "
        "the configuration module is deprecated. Please access the "
        "configuration from the 'configuration.conf' object via "
        "'conf.{f.__name__}'".format(f=func))
Beispiel #11
0
# Old import machinary below.
#
# This is deprecated but should be kept until Airflow 2.0
# for compatibility.
#
# ------------------------------------------------------------------------

# Imports the operators dynamically while keeping the package API clean,
# abstracting the underlying modules
from airflow.utils.helpers import import_module_attrs as _import_module_attrs

_operators = {
    'ssh_execute_operator': ['SSHExecuteOperator'],
    'vertica_operator': ['VerticaOperator'],
    'vertica_to_hive': ['VerticaToHiveTransfer'],
    'qubole_operator': ['QuboleOperator'],
    'fs': ['FileSensor']
}

import os as _os
if not _os.environ.get('AIRFLOW_USE_NEW_IMPORTS', False):
    from zope.deprecation import deprecated as _deprecated
    _imported = _import_module_attrs(globals(), _operators)
    for _i in _imported:
        _deprecated(
            _i,
            "Importing {i} directly from 'contrib.operators' has been "
            "deprecated. Please import from "
            "'contrib.operators.[operator_module]' instead. Support for direct "
            "imports will be dropped entirely in Airflow 2.0.".format(i=_i))