You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by da...@apache.org on 2017/07/24 20:14:00 UTC

incubator-airflow git commit: [AIRFLOW-1448] Revert "Fix cli reading logfile in memory"

Repository: incubator-airflow
Updated Branches:
  refs/heads/master 6d348903a -> 426b6a65f


[AIRFLOW-1448] Revert "Fix cli reading logfile in memory"

This reverts commit
2de4b7cfb12f5a36eeaf5e78d3ee0fb12d67f3b2 which was
breaking CI due to a logical merge conflict.

Closes #2475 from aoen/ddavydov--revert_bad_pr


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

Branch: refs/heads/master
Commit: 426b6a65f6ec142449893e36fcd677941bdad879
Parents: 6d34890
Author: Dan Davydov <da...@airbnb.com>
Authored: Mon Jul 24 13:13:36 2017 -0700
Committer: Dan Davydov <da...@airbnb.com>
Committed: Mon Jul 24 13:13:37 2017 -0700

----------------------------------------------------------------------
 airflow/bin/cli.py | 11 ++---------
 tests/core.py      | 26 --------------------------
 2 files changed, 2 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/426b6a65/airflow/bin/cli.py
----------------------------------------------------------------------
diff --git a/airflow/bin/cli.py b/airflow/bin/cli.py
index de8e9f3..a8543d3 100755
--- a/airflow/bin/cli.py
+++ b/airflow/bin/cli.py
@@ -461,10 +461,6 @@ def run(args, dag=None):
     logging.root.handlers = []
 
     # store logs remotely
-    _store_logs_remotely(log_base, filename)
-
-
-def _store_logs_remotely(log_base, filename):
     remote_base = conf.get('core', 'REMOTE_BASE_LOG_FOLDER')
 
     # deprecated as of March 2016
@@ -476,10 +472,7 @@ def _store_logs_remotely(log_base, filename):
             DeprecationWarning)
         remote_base = conf.get('core', 'S3_LOG_FOLDER')
 
-    if remote_base == 'None':
-        remote_base = None
-
-    if remote_base and os.path.exists(filename):
+    if os.path.exists(filename):
         # read log and remove old logs to get just the latest additions
 
         with open(filename, 'r') as logfile:
@@ -494,7 +487,7 @@ def _store_logs_remotely(log_base, filename):
         elif remote_base.startswith('gs:/'):
             logging_utils.GCSLog().write(log, remote_log_location)
         # Other
-        else:
+        elif remote_base and remote_base != 'None':
             logging.error(
                 'Unsupported remote log location: {}'.format(remote_base))
 

http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/426b6a65/tests/core.py
----------------------------------------------------------------------
diff --git a/tests/core.py b/tests/core.py
index 4e81534..923e0c3 100644
--- a/tests/core.py
+++ b/tests/core.py
@@ -1326,32 +1326,6 @@ class CliTests(unittest.TestCase):
             'run', 'example_bash_operator', 'runme_0', '-l',
             DEFAULT_DATE.isoformat()]))
 
-    def test_cli_store_logs_remotely_no_remote_base(self):
-        with mock.patch('__main__.open', mock.mock_open(read_data='42'), create=True) as open_mock:
-            with mock.patch('os.path.exists') as path_mock:
-                path_mock.return_value = True
-
-                cli._store_logs_remotely("42", "existing_file")
-
-            # remote base not specified, hence no call to open
-            self.assertEqual(open_mock.call_count, 0)
-
-    def test_cli_store_logs_remotely_with_remote_base(self):
-        orig_base_log_folder = configuration.get('core', 'REMOTE_BASE_LOG_FOLDER')
-        configuration.set("core", "REMOTE_BASE_LOG_FOLDER", "42")
-
-        try:
-            with mock.patch('airflow.bin.cli.open', mock.mock_open(read_data='42'), create=True) as open_mock:
-                with mock.patch('os.path.exists') as path_mock:
-                    path_mock.return_value = True
-
-                    cli._store_logs_remotely("42", "existing_file")
-
-                # remote base specified, hence one call to open
-                self.assertEqual(open_mock.call_count, 1)
-        finally:    
-            configuration.set("core", "REMOTE_BASE_LOG_FOLDER", orig_base_log_folder)
-
     def test_task_state(self):
         cli.task_state(self.parser.parse_args([
             'task_state', 'example_bash_operator', 'runme_0',