[ARVADOS] updated: bd680fb1df7a5eec4f36d6fa35474d781f63af81

git at public.curoverse.com git at public.curoverse.com
Wed Jan 14 15:33:59 EST 2015


Summary of changes:
 sdk/python/arvados/keep.py      | 13 +++++--------
 sdk/python/tests/test_errors.py |  1 -
 2 files changed, 5 insertions(+), 9 deletions(-)

       via  bd680fb1df7a5eec4f36d6fa35474d781f63af81 (commit)
       via  1cb770f167b703238d92dc917bed017846428c58 (commit)
      from  d8148b70c8bbf814a53e5d5b9d92710d44b11107 (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 bd680fb1df7a5eec4f36d6fa35474d781f63af81
Author: Brett Smith <brett at curoverse.com>
Date:   Wed Jan 14 15:22:24 2015 -0500

    3835: PySDK raises NotFoundError when all Keep services report such.
    
    Previously, we raised this error when >= 75% of services reported
    such, as the most reasonable available cutoff to make the
    distinction.  Now that Keep exceptions include detailed information
    about the error from each service, it seems useful to make this
    threshold stricter, and only raise NotFoundError when we're sure
    that's the problem.  See further discussion from
    <https://arvados.org/issues/3835#note-11>.

diff --git a/sdk/python/arvados/keep.py b/sdk/python/arvados/keep.py
index 471544c..7c53339 100644
--- a/sdk/python/arvados/keep.py
+++ b/sdk/python/arvados/keep.py
@@ -643,25 +643,22 @@ class KeepClient(object):
         if loop.success():
             return blob
 
-        # No servers fulfilled the request.  Count how many responded
-        # "not found;" if the ratio is high enough (currently 75%), report
-        # Not Found; otherwise a generic error.
-        # Q: Including 403 is necessary for the Keep tests to continue
-        # passing, but maybe they should expect KeepReadError instead?
-        not_founds = sum(1 for ks in roots_map.values()
-                         if ks.last_status() in set([403, 404, 410]))
         try:
             all_roots = local_roots + hint_roots
         except NameError:
             # We never successfully fetched local_roots.
             all_roots = hint_roots
+        # Q: Including 403 is necessary for the Keep tests to continue
+        # passing, but maybe they should expect KeepReadError instead?
+        not_founds = sum(1 for key in all_roots
+                         if roots_map[key].last_status() in {403, 404, 410})
         service_errors = ((key, roots_map[key].last_result)
                           for key in all_roots)
         if not roots_map:
             raise arvados.errors.KeepReadError(
                 "failed to read {}: no Keep services available ({})".format(
                     loc_s, loop.last_result()))
-        elif ((float(not_founds) / len(roots_map)) >= .75):
+        elif not_founds == len(all_roots):
             raise arvados.errors.NotFoundError(
                 "{} not found".format(loc_s), service_errors)
         else:

commit 1cb770f167b703238d92dc917bed017846428c58
Author: Brett Smith <brett at curoverse.com>
Date:   Wed Jan 14 14:20:01 2015 -0500

    3835: Fixup unneeded commit.

diff --git a/sdk/python/tests/test_errors.py b/sdk/python/tests/test_errors.py
index 948a40b..cf06c84 100644
--- a/sdk/python/tests/test_errors.py
+++ b/sdk/python/tests/test_errors.py
@@ -1,6 +1,5 @@
 #!/usr/bin/env python
 
-import collections
 import traceback
 import unittest
 

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list