You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ka...@apache.org on 2020/06/14 13:08:04 UTC

[airflow] 01/01: Revert "Make airflow/settings.py Pylint compatible (#9286)"

This is an automated email from the ASF dual-hosted git repository.

kaxilnaik pushed a commit to branch revert-9286-settings.py-compatible
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit c2694321630bdf5eba8aeb708cc900ef93bbe52a
Author: Kaxil Naik <ka...@gmail.com>
AuthorDate: Sun Jun 14 14:07:23 2020 +0100

    Revert "Make airflow/settings.py Pylint compatible (#9286)"
    
    This reverts commit 2dc85a9e9948f87c6557d1a483e0b72d1cf1cb9a.
---
 airflow/settings.py        | 21 ++++++---------------
 scripts/ci/pylint_todo.txt |  2 ++
 2 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/airflow/settings.py b/airflow/settings.py
index 2fc8111..4d4270b 100644
--- a/airflow/settings.py
+++ b/airflow/settings.py
@@ -32,7 +32,6 @@ from sqlalchemy.pool import NullPool
 
 # noinspection PyUnresolvedReferences
 from airflow import api
-# pylint: disable=unused-import
 from airflow.configuration import AIRFLOW_HOME, WEBSERVER_CONFIG, conf  # NOQA F401
 from airflow.logging_config import configure_logging
 from airflow.utils.sqlalchemy import setup_event_handlers
@@ -52,7 +51,7 @@ try:
         TIMEZONE = pendulum.tz.local_timezone()
     else:
         TIMEZONE = pendulum.tz.timezone(tz)
-except Exception:  # pylint: disable=broad-except
+except Exception:
     pass
 log.info("Configured default timezone %s", TIMEZONE)
 
@@ -82,10 +81,10 @@ engine: Optional[Engine] = None
 Session: Optional[SASession] = None
 
 # The JSON library to use for DAG Serialization and De-Serialization
-json = json  # pylint: disable=self-assigning-variable
+json = json
 
 
-def policy(task: 'BaseOperator'):  # pylint: disable=unused-argument
+def policy(task: 'BaseOperator'):
     """
     This policy setting allows altering tasks after they are loaded in
     the DagBag. It allows administrator to rewire some task parameters.
@@ -104,7 +103,7 @@ def policy(task: 'BaseOperator'):  # pylint: disable=unused-argument
     """
 
 
-def task_instance_mutation_hook(task_instance: 'TaskInstance'):  # pylint: disable=unused-argument
+def task_instance_mutation_hook(task_instance: 'TaskInstance'):
     """
     This setting allows altering task instances before they are queued by
     the Airflow scheduler.
@@ -116,7 +115,7 @@ def task_instance_mutation_hook(task_instance: 'TaskInstance'):  # pylint: disab
     """
 
 
-def pod_mutation_hook(pod):  # pylint: disable=unused-argument
+def pod_mutation_hook(pod):
     """
     This setting allows altering ``kubernetes.client.models.V1Pod`` object
     before they are passed to the Kubernetes client by the ``PodLauncher``
@@ -131,9 +130,7 @@ def pod_mutation_hook(pod):  # pylint: disable=unused-argument
     """
 
 
-# pylint: disable=global-statement
 def configure_vars():
-    """ Configure Global Variables from airflow.cfg"""
     global SQL_ALCHEMY_CONN
     global DAGS_FOLDER
     global PLUGINS_FOLDER
@@ -148,7 +145,6 @@ def configure_vars():
 
 
 def configure_orm(disable_connection_pool=False):
-    """ Configure ORM using SQLAlchemy"""
     log.debug("Setting up DB connection pool (PID %s)", os.getpid())
     global engine
     global Session
@@ -230,7 +226,6 @@ def dispose_orm():
 
 
 def configure_adapters():
-    """ Register Adapters and DB Converters """
     from pendulum import DateTime as Pendulum
     try:
         from sqlite3 import register_adapter
@@ -250,7 +245,6 @@ def configure_adapters():
 
 
 def validate_session():
-    """ Validate ORM Session """
     worker_precheck = conf.getboolean('core', 'worker_precheck', fallback=False)
     if not worker_precheck:
         return True
@@ -294,8 +288,7 @@ def prepare_syspath():
 
 
 def import_local_settings():
-    """ Import airflow_local_settings.py files to allow overriding any configs in settings.py file """
-    try:  # pylint: disable=too-many-nested-blocks
+    try:
         import airflow_local_settings
 
         if hasattr(airflow_local_settings, "__all__"):
@@ -312,7 +305,6 @@ def import_local_settings():
 
 
 def initialize():
-    """ Initialize Airflow with all the settings from this file """
     configure_vars()
     prepare_syspath()
     import_local_settings()
@@ -326,7 +318,6 @@ def initialize():
 
     # Ensure we close DB connections at scheduler and gunicon worker terminations
     atexit.register(dispose_orm)
-# pylint: enable=global-statement
 
 
 # Const stuff
diff --git a/scripts/ci/pylint_todo.txt b/scripts/ci/pylint_todo.txt
index 0a71580..a855986 100644
--- a/scripts/ci/pylint_todo.txt
+++ b/scripts/ci/pylint_todo.txt
@@ -18,6 +18,7 @@
 ./airflow/models/taskinstance.py
 ./airflow/models/variable.py
 ./airflow/models/xcom.py
+./airflow/settings.py
 ./airflow/stats.py
 ./airflow/www/api/experimental/endpoints.py
 ./airflow/www/app.py
@@ -31,3 +32,4 @@
 ./airflow/www/validators.py
 ./airflow/www/views.py
 ./airflow/www/widgets.py
+./scripts/perf/scheduler_ops_metrics.py