[ARVADOS] updated: a6e5b740e7619a266c1e76b0ddbba943038c1efb

git at public.curoverse.com git at public.curoverse.com
Thu Aug 20 16:42:02 EDT 2015


Summary of changes:
 sdk/python/arvados/__init__.py |  1 +
 sdk/python/tests/test_init.py  | 39 +++++++++++++++++++++++++++------------
 2 files changed, 28 insertions(+), 12 deletions(-)

       via  a6e5b740e7619a266c1e76b0ddbba943038c1efb (commit)
      from  e09bff41f4beb428545f043cedb20bb5e44924d6 (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 a6e5b740e7619a266c1e76b0ddbba943038c1efb
Author: Bryan Cosca <bcosc at curoverse.com>
Date:   Thu Aug 20 16:41:57 2015 -0400

    flailing and added more comments

diff --git a/sdk/python/arvados/__init__.py b/sdk/python/arvados/__init__.py
index dbc6e01..c506dd2 100644
--- a/sdk/python/arvados/__init__.py
+++ b/sdk/python/arvados/__init__.py
@@ -59,6 +59,7 @@ def task_set_output(self,s,api_client=None,num_retries=None):
                                                      }).execute()            
         except errors.ApiError as error:
             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:
             if not retry.check_http_response_success(error.status_code):
                 if retry.check_http_response_success(error.status_code) == False:
diff --git a/sdk/python/tests/test_init.py b/sdk/python/tests/test_init.py
index 63c96a9..fcb7f30 100644
--- a/sdk/python/tests/test_init.py
+++ b/sdk/python/tests/test_init.py
@@ -12,20 +12,35 @@ from arvados_testutil import FakeCurl
 from arvados_testutil import queue_with
 from arvados_testutil import mock_responses
 
+ at tutil.skip_sleep
 class SDKTestCase(unittest.TestCase, tutil.ApiClientMock):
 
-    def check_errors_from_last_retry(self, verb, exc_class):
-        api_client = self.mock_keep_services(count=2)
-        req_mock = tutil.mock_keep_responses(
-            "retry error reporting test")
-        with req_mock, tutil.skip_sleep, \
-                self.assertRaises(exc_class) as err_check:
-            keep_client = arvados.KeepClient(api_client=api_client)
-            getattr(keep_client, verb)('d41d8cd98f00b204e9800998ecf8427e+0',
-                                       num_retries=3)
-        self.assertEqual([403, 403], [
-                getattr(error, 'status_code', None)
-                for error in err_check.exception.request_errors().itervalues()])
+    def test_mock_keep_responses_works(self):
+        api_client = mock.MagicMock()
+        req_mock = tutil.mock_keep_responses("retry error reporting test", 500, 500, 403, 403)
+        with req_mock, self.assertRaises(arvados.errors.ApiError) as err_check:
+            arvados.task_set_output({'uuid':'zzzzz-zzzzz-zzzzzzzzzzzzzzz'},s='7idummyhashb0b1f1f03e4e6f69c4a4e+28243',api_client=api_client)
+            self.assertEqual(err_check,False) # Need a spy assert to see why ApiError/HttpError isn't getting called
+
+            
+        #with tutil.mock_keep_responses('foo', 500, 500, 403, 403):
+        #    arvados.task_set_output({'uuid':'zzzzz-zzzzz-zzzzzzzzzzzzzzz'},s='7idummyhashb0b1f1f03e4e6f69c4a4e+28243',api_client=api_client)
+    
+#    def check_errors_from_last_retry(self, verb, exc_class):
+#        api_client = self.mock_keep_services(count=2)
+#        req_mock = tutil.mock_keep_responses(
+#            "retry error reporting test")
+#        with req_mock, tutil.skip_sleep, \
+#                self.assertRaises(exc_class) as err_check:
+#            keep_client = arvados.KeepClient(api_client=api_client)
+#            getattr(keep_client, verb)('d41d8cd98f00b204e9800998ecf8427e+0',
+#                                       num_retries=3)
+#        self.assertEqual([403, 403], [
+#                getattr(error, 'status_code', None)
+#                for error in err_check.exception.request_errors().itervalues()])
+
+#    def test_get_error_reflects_last_retry(self):
+#        self.check_errors_from_last_retry('get', arvados.errors.KeepReadError)
 
 #### tests for functions, not methods ####
 

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list