You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by fo...@apache.org on 2018/05/07 20:02:12 UTC

incubator-airflow git commit: [AIRFLOW-2407] Resolve Python undefined names

Repository: incubator-airflow
Updated Branches:
  refs/heads/master c27d8fd0b -> b9eb52cc0


[AIRFLOW-2407] Resolve Python undefined names

Closes #3307 from cclauss/AIRFLOW-2407


Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/b9eb52cc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/b9eb52cc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/b9eb52cc

Branch: refs/heads/master
Commit: b9eb52cc012637e69c0423441d645f1caa561f9b
Parents: c27d8fd
Author: cclauss <cc...@bluewin.ch>
Authored: Mon May 7 22:02:04 2018 +0200
Committer: Fokko Driesprong <fo...@godatadriven.com>
Committed: Mon May 7 22:02:04 2018 +0200

----------------------------------------------------------------------
 airflow/contrib/auth/backends/kerberos_auth.py         | 3 ++-
 airflow/contrib/hooks/aws_hook.py                      | 1 +
 airflow/contrib/operators/datastore_export_operator.py | 1 +
 airflow/contrib/operators/datastore_import_operator.py | 3 +--
 airflow/contrib/sensors/qubole_sensor.py               | 3 ++-
 tests/operators/test_virtualenv_operator.py            | 2 +-
 6 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/b9eb52cc/airflow/contrib/auth/backends/kerberos_auth.py
----------------------------------------------------------------------
diff --git a/airflow/contrib/auth/backends/kerberos_auth.py b/airflow/contrib/auth/backends/kerberos_auth.py
index f6f9d69..0dc8bd4 100644
--- a/airflow/contrib/auth/backends/kerberos_auth.py
+++ b/airflow/contrib/auth/backends/kerberos_auth.py
@@ -17,8 +17,9 @@
 # specific language governing permissions and limitations
 # under the License.
 
+import logging
 import flask_login
-from flask_login import login_required, current_user, logout_user
+from flask_login import current_user
 from flask import flash
 from wtforms import (
     Form, PasswordField, StringField)

http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/b9eb52cc/airflow/contrib/hooks/aws_hook.py
----------------------------------------------------------------------
diff --git a/airflow/contrib/hooks/aws_hook.py b/airflow/contrib/hooks/aws_hook.py
index 29bf740..c8ded4d 100644
--- a/airflow/contrib/hooks/aws_hook.py
+++ b/airflow/contrib/hooks/aws_hook.py
@@ -20,6 +20,7 @@
 
 import boto3
 import configparser
+import logging
 
 from airflow.exceptions import AirflowException
 from airflow.hooks.base_hook import BaseHook

http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/b9eb52cc/airflow/contrib/operators/datastore_export_operator.py
----------------------------------------------------------------------
diff --git a/airflow/contrib/operators/datastore_export_operator.py b/airflow/contrib/operators/datastore_export_operator.py
index 15b19ec..09b7965 100644
--- a/airflow/contrib/operators/datastore_export_operator.py
+++ b/airflow/contrib/operators/datastore_export_operator.py
@@ -19,6 +19,7 @@
 #
 from airflow.contrib.hooks.datastore_hook import DatastoreHook
 from airflow.contrib.hooks.gcs_hook import GoogleCloudStorageHook
+from airflow.exceptions import AirflowException
 from airflow.models import BaseOperator
 from airflow.utils.decorators import apply_defaults
 

http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/b9eb52cc/airflow/contrib/operators/datastore_import_operator.py
----------------------------------------------------------------------
diff --git a/airflow/contrib/operators/datastore_import_operator.py b/airflow/contrib/operators/datastore_import_operator.py
index 2c9c75e..279b1a5 100644
--- a/airflow/contrib/operators/datastore_import_operator.py
+++ b/airflow/contrib/operators/datastore_import_operator.py
@@ -18,6 +18,7 @@
 # under the License.
 #
 from airflow.contrib.hooks.datastore_hook import DatastoreHook
+from airflow.exceptions import AirflowException
 from airflow.models import BaseOperator
 from airflow.utils.decorators import apply_defaults
 
@@ -88,11 +89,9 @@ class DatastoreImportOperator(BaseOperator):
         result = ds_hook.poll_operation_until_done(operation_name,
                                                    self.polling_interval_in_seconds)
 
-
         state = result['metadata']['common']['state']
         if state != 'SUCCESSFUL':
             raise AirflowException('Operation failed: result={}'.format(result))
 
         if self.xcom_push:
             return result
-

http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/b9eb52cc/airflow/contrib/sensors/qubole_sensor.py
----------------------------------------------------------------------
diff --git a/airflow/contrib/sensors/qubole_sensor.py b/airflow/contrib/sensors/qubole_sensor.py
index 2860f92..4f00e55 100644
--- a/airflow/contrib/sensors/qubole_sensor.py
+++ b/airflow/contrib/sensors/qubole_sensor.py
@@ -56,6 +56,7 @@ class QuboleSensor(BaseSensorOperator):
         super(QuboleSensor, self).__init__(*args, **kwargs)
 
     def poke(self, context):
+        global this  # apache/incubator-airflow/pull/3297#issuecomment-385988083
         conn = BaseHook.get_connection(self.qubole_conn_id)
         Qubole.configure(api_token=conn.password, api_url=conn.host)
 
@@ -65,7 +66,7 @@ class QuboleSensor(BaseSensorOperator):
         try:
             status = self.sensor_class.check(self.data)
         except Exception as e:
-            logging.exception(e)
+            this.log.exception(e)
             status = False
 
         this.log.info('Status of this Poke: %s', status)

http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/b9eb52cc/tests/operators/test_virtualenv_operator.py
----------------------------------------------------------------------
diff --git a/tests/operators/test_virtualenv_operator.py b/tests/operators/test_virtualenv_operator.py
index b1d62e3..82abe9c 100644
--- a/tests/operators/test_virtualenv_operator.py
+++ b/tests/operators/test_virtualenv_operator.py
@@ -163,6 +163,7 @@ class TestPythonVirtualenvOperator(unittest.TestCase):
 
     def test_string_args(self):
         def f():
+            global virtualenv_string_args
             print(virtualenv_string_args)
             if virtualenv_string_args[0] != virtualenv_string_args[2]:
                 raise Exception
@@ -197,4 +198,3 @@ class TestPythonVirtualenvOperator(unittest.TestCase):
         def f(**kwargs):
             return kwargs['templates_dict']['ds']
         self._run_as_operator(f, templates_dict={'ds': '{{ ds }}'})
-