[ARVADOS] updated: 1.3.0-413-g703b21198

Git user git at public.curoverse.com
Fri Mar 1 17:05:08 EST 2019


Summary of changes:
 sdk/cwl/arvados_cwl/executor.py | 38 ++++++++++++++++++++++----------------
 sdk/cwl/tests/test_container.py | 22 ++++++++++++++++++++++
 2 files changed, 44 insertions(+), 16 deletions(-)

       via  703b21198473ca619b1c83726bc654563384d96f (commit)
       via  d99fc30eb4a6e3f798dfb80ea010e313490683ae (commit)
       via  58bc1b8355b0a09c09fe56d1fca82dfdb830efee (commit)
      from  e231fef37079916d0dc6babf93d669d474598ced (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 703b21198473ca619b1c83726bc654563384d96f
Author: Eric Biagiotti <ebiagiotti at veritasgenetics.com>
Date:   Fri Mar 1 17:04:57 2019 -0500

    14886: Adds flag to stop infinite logs
    
    Arvados-DCO-1.1-Signed-off-by: Eric Biagiotti <ebiagiotti at veritasgenetics.com>

diff --git a/sdk/cwl/arvados_cwl/executor.py b/sdk/cwl/arvados_cwl/executor.py
index c1f2b5474..319e8a887 100644
--- a/sdk/cwl/arvados_cwl/executor.py
+++ b/sdk/cwl/arvados_cwl/executor.py
@@ -59,6 +59,7 @@ class RuntimeStatusLoggingHandler(logging.Handler):
     def __init__(self, runtime_status_update_func):
         super(RuntimeStatusLoggingHandler, self).__init__()
         self.runtime_status_update = runtime_status_update_func
+        self.updatingRuntimeStatus = False
 
     def emit(self, record):
         kind = None
@@ -66,22 +67,27 @@ class RuntimeStatusLoggingHandler(logging.Handler):
             kind = 'error'
         elif record.levelno >= logging.WARNING:
             kind = 'warning'
-        if kind is not None:
-            log_msg = record.getMessage()
-            if '\n' in log_msg:
-                # If the logged message is multi-line, use its first line as status
-                # and the rest as detail.
-                status, detail = log_msg.split('\n', 1)
-                self.runtime_status_update(
-                    kind,
-                    "%s: %s" % (record.name, status),
-                    detail
-                )
-            else:
-                self.runtime_status_update(
-                    kind,
-                    "%s: %s" % (record.name, record.getMessage())
-                )
+        if kind is not None and self.updatingRuntimeStatus is not True:
+            self.updatingRuntimeStatus = True
+            try:
+                log_msg = record.getMessage()
+                if '\n' in log_msg:
+                    # If the logged message is multi-line, use its first line as status
+                    # and the rest as detail.
+                    status, detail = log_msg.split('\n', 1)
+                    self.runtime_status_update(
+                        kind,
+                        "%s: %s" % (record.name, status),
+                        detail
+                    )
+                else:
+                    self.runtime_status_update(
+                        kind,
+                        "%s: %s" % (record.name, record.getMessage())
+                    )
+            finally:
+                self.updatingRuntimeStatus = False
+            
 
 class ArvCwlExecutor(object):
     """Execute a CWL tool or workflow, submit work (using either jobs or

commit d99fc30eb4a6e3f798dfb80ea010e313490683ae
Author: Eric Biagiotti <ebiagiotti at veritasgenetics.com>
Date:   Fri Mar 1 16:54:30 2019 -0500

    14886: Simplifies test mocking
    
    Arvados-DCO-1.1-Signed-off-by: Eric Biagiotti <ebiagiotti at veritasgenetics.com>

diff --git a/sdk/cwl/tests/test_container.py b/sdk/cwl/tests/test_container.py
index 0af246bea..6ca5827a0 100644
--- a/sdk/cwl/tests/test_container.py
+++ b/sdk/cwl/tests/test_container.py
@@ -503,22 +503,23 @@ class TestContainer(unittest.TestCase):
     # Test for issue 14886
     # Test to make sure we dont call runtime_status_update if we already did
     # some where higher up in the call stack
-    def test_runtime_status_update_api_failure(self):
+    @mock.patch("arvados_cwl.util.get_current_container")
+    def test_infinite_runtime_status_update(self, gcc_mock):
         api = mock.MagicMock()
         api._rootDesc = copy.deepcopy(get_rootDesc())
         del api._rootDesc.get('resources')['jobs']['methods']['create']
         
         # Make sure ArvCwlExecutor thinks it's running inside a container so it
         # adds the logging handler that will call runtime_status_update()
-        api.containers().current().execute.return_value = mock.MagicMock()
         runner = arvados_cwl.ArvCwlExecutor(api)
         self.assertEqual(runner.work_api, 'containers')        
         root_logger = logging.getLogger('')
         handlerClasses = [h.__class__ for h in root_logger.handlers]
         self.assertTrue(arvados_cwl.RuntimeStatusLoggingHandler in handlerClasses)
         
-        # api.containers() is invoked when we call root_logger.error, so try and log again!
-        api.containers().current.side_effect = lambda : root_logger.error("Second Error")
+        # get_current_container is invoked when we call runtime_status_update
+        # so try and log again!
+        gcc_mock.side_effect = lambda *args: root_logger.error("Second Error")
         root_logger.error("First Error")
 
     @mock.patch("arvados_cwl.util.get_current_container")

commit 58bc1b8355b0a09c09fe56d1fca82dfdb830efee
Author: Eric Biagiotti <ebiagiotti at veritasgenetics.com>
Date:   Fri Mar 1 16:24:25 2019 -0500

    14886: Adds a test that reproduces the error
    
    Arvados-DCO-1.1-Signed-off-by: Eric Biagiotti <ebiagiotti at veritasgenetics.com>

diff --git a/sdk/cwl/tests/test_container.py b/sdk/cwl/tests/test_container.py
index de21fc0b9..0af246bea 100644
--- a/sdk/cwl/tests/test_container.py
+++ b/sdk/cwl/tests/test_container.py
@@ -500,6 +500,27 @@ class TestContainer(unittest.TestCase):
         arvjob.output_callback.assert_called_with({"out": "stuff"}, "success")
         runner.add_intermediate_output.assert_called_with("zzzzz-4zz18-zzzzzzzzzzzzzz2")
 
+    # Test for issue 14886
+    # Test to make sure we dont call runtime_status_update if we already did
+    # some where higher up in the call stack
+    def test_runtime_status_update_api_failure(self):
+        api = mock.MagicMock()
+        api._rootDesc = copy.deepcopy(get_rootDesc())
+        del api._rootDesc.get('resources')['jobs']['methods']['create']
+        
+        # Make sure ArvCwlExecutor thinks it's running inside a container so it
+        # adds the logging handler that will call runtime_status_update()
+        api.containers().current().execute.return_value = mock.MagicMock()
+        runner = arvados_cwl.ArvCwlExecutor(api)
+        self.assertEqual(runner.work_api, 'containers')        
+        root_logger = logging.getLogger('')
+        handlerClasses = [h.__class__ for h in root_logger.handlers]
+        self.assertTrue(arvados_cwl.RuntimeStatusLoggingHandler in handlerClasses)
+        
+        # api.containers() is invoked when we call root_logger.error, so try and log again!
+        api.containers().current.side_effect = lambda : root_logger.error("Second Error")
+        root_logger.error("First Error")
+
     @mock.patch("arvados_cwl.util.get_current_container")
     @mock.patch("arvados.collection.CollectionReader")
     @mock.patch("arvados.collection.Collection")

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list