[ARVADOS] updated: 28bdfc61b7bb2d6bed3b62af8a4b328f3e7d767d

git at public.curoverse.com git at public.curoverse.com
Mon Aug 24 16:51:36 EDT 2015


Summary of changes:
 sdk/python/arvados/__init__.py     | 21 ++++++++++++++++-----
 sdk/python/tests/test_init_temp.py | 10 +++++-----
 2 files changed, 21 insertions(+), 10 deletions(-)

       via  28bdfc61b7bb2d6bed3b62af8a4b328f3e7d767d (commit)
      from  73bfa6243c359171d13c791c48195ade6bbf7520 (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 28bdfc61b7bb2d6bed3b62af8a4b328f3e7d767d
Author: Bryan Cosca <bcosc at curoverse.com>
Date:   Mon Aug 24 16:51:30 2015 -0400

    flailing 8.24 4.51

diff --git a/sdk/python/arvados/__init__.py b/sdk/python/arvados/__init__.py
index c506dd2..1591539 100644
--- a/sdk/python/arvados/__init__.py
+++ b/sdk/python/arvados/__init__.py
@@ -51,6 +51,7 @@ def task_set_output(self,s,api_client=None,num_retries=None):
     output_retry_loop = RetryLoop(num_retries=num_retries, backoff_start=0)
     for tries_left in output_retry_loop:
         try:
+            print "Trying api call"
             result = api_client.job_tasks().update(uuid=self['uuid'],
                                                 body={
                                                       'output':s,
@@ -58,19 +59,29 @@ def task_set_output(self,s,api_client=None,num_retries=None):
                                                       'progress':1.0
                                                      }).execute()            
         except errors.ApiError as error:
-            logger.debug("ApiError {}, retrying with {} tries_left".format(error,tries_left+1))
+            print "ApiError Raised"
+            #logger.debug("ApiError {}, retrying with {} tries_left".format(error,tries_left+1))
             # How do we check if its a retryable ApiError or not? ApiError inherits HttpError but how do we check for status code?
         except errors.HttpError as error:
+            print "HttpError raised"
             if not retry.check_http_response_success(error.status_code):
                 if retry.check_http_response_success(error.status_code) == False:
-                    logger.debug("HttpError returned {}, saving error and not retrying.".format(error.status_code))
-                    output_retry_loop.save_result(error)
+                    print "False retry code"
+                    #logger.debug("HttpError returned {}, saving error and not retrying.".format(error.status_code))
+                    raise
+                    #output_retry_loop.save_result(error)
                 else:
-                    logger.debug("HttpError returned {}, retrying with {} tries left".format(error.status_code,tries_left+1))
+                    print "Retrying with tries left"
+                    #logger.debug("HttpError returned {}, retrying with {} tries left".format(error.status_code,tries_left+1))
         else:
+            print "Output is good"
             output_retry_loop.save_result(result)
     if output_retry_loop.success():
-        return output_retry_loop.last_result()	    
+        print "Output Retry loop is successful"
+        return output_retry_loop.last_result()
+    else:
+        print "Output Retry loop is not successful"
+        self.tries_left = num_retries + 1
 
 _current_task = None
 def current_task(api_client=None):
diff --git a/sdk/python/tests/test_init_temp.py b/sdk/python/tests/test_init_temp.py
index 7b5bf66..cf6672b 100644
--- a/sdk/python/tests/test_init_temp.py
+++ b/sdk/python/tests/test_init_temp.py
@@ -3,6 +3,7 @@
 import mock
 import os
 import unittest
+import hashlib
 
 import arvados
 import arvados.collection
@@ -16,8 +17,7 @@ from arvados_testutil import mock_responses
 class SDKTestCase(unittest.TestCase, tutil.ApiClientMock):
 
     def test_mock_keep_responses_works(self):
-        api_client = mock.MagicMock()
-        req_mock = tutil.mock_keep_responses("retry error reporting test", 403)
-        with req_mock, self.assertRaises(arvados.errors.HttpError) as err_check:
-            arvados.task_set_output({'uuid':'zzzzz-zzzzz-zzzzzzzzzzzzzzz'},s='7idummyhashb0b1f1f03e4e6f69c4a4e+28243',api_client=api_client)
-            self.assertEqual(err_check,err_check.exception.request_errors()) # Need a spy assert to see why ApiError/HttpError isn't getting called
+        api_client = self.api_client_mock()
+        req_mock = self._mock_api_call(api_client.job_tasks().update().execute, 500,'Error')
+        with self.assertRaises(arvados.errors.HttpError) as err_check:
+            arvados.task_set_output({'uuid':'zzzzz-zzzzz-zzzzzzzzzzzzzzz'},s='d41d8cd98f00b204e9800998ecf8427e+0',api_client=api_client,num_retries=2)

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list