[ARVADOS] updated: 63b03a39adfd78961c5bbb6a3a2d02ccd8c92e4d

git at public.curoverse.com git at public.curoverse.com
Thu Feb 26 13:17:38 EST 2015


Summary of changes:
 sdk/python/arvados/_normalize_stream.py |  2 ++
 sdk/python/arvados/arvfile.py           | 19 +++++++++-
 sdk/python/arvados/collection.py        |  5 +++
 sdk/python/arvados/errors.py            | 39 ++++++++++----------
 sdk/python/arvados/keep.py              |  4 +--
 sdk/python/arvados/stream.py            |  5 +--
 sdk/python/tests/test_arvfile.py        | 64 ++++++++++++++++++++++-----------
 sdk/python/tests/test_collections.py    |  6 ++--
 sdk/python/tests/test_errors.py         | 30 ++++++++--------
 sdk/python/tests/test_keep_client.py    |  8 ++---
 10 files changed, 114 insertions(+), 68 deletions(-)

       via  63b03a39adfd78961c5bbb6a3a2d02ccd8c92e4d (commit)
      from  cb8320961335a4732c470882fcfcd4e6c581a0d4 (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 63b03a39adfd78961c5bbb6a3a2d02ccd8c92e4d
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Thu Feb 26 13:19:50 2015 -0500

    4823: Add flush() to ArvadosFile.  Fix tests to avoid using internal APIs.  Fix
    import in _normalize_stream.  Make KeepRequestError more generic (now
    represents a list of "request errors" instead of "service errors").

diff --git a/sdk/python/arvados/_normalize_stream.py b/sdk/python/arvados/_normalize_stream.py
index 400a38e..e0831b1 100644
--- a/sdk/python/arvados/_normalize_stream.py
+++ b/sdk/python/arvados/_normalize_stream.py
@@ -1,3 +1,5 @@
+import config
+
 def normalize_stream(stream_name, stream):
     """Take manifest stream and return a list of tokens in normalized format.
 
diff --git a/sdk/python/arvados/arvfile.py b/sdk/python/arvados/arvfile.py
index c4bbf64..f9f91cf 100644
--- a/sdk/python/arvados/arvfile.py
+++ b/sdk/python/arvados/arvfile.py
@@ -534,7 +534,7 @@ class _BlockManager(object):
                             err.append(self._put_errors.get(False))
                     except Queue.Empty:
                         pass
-                    raise KeepWriteError("Error writing some blocks", err)
+                    raise KeepWriteError("Error writing some blocks", err, label="block")
 
     def block_prefetch(self, locator):
         """Initiate a background download of a block.
@@ -791,6 +791,13 @@ class ArvadosFile(object):
 
         replace_range(self._segments, offset, len(data), self._current_bblock.blockid, self._current_bblock.write_pointer - len(data))
 
+    @synchronized
+    def flush(self):
+        if self._current_bblock:
+            self._repack_writes()
+            self.parent._my_block_manager().commit_bufferblock(self._current_bblock)
+
+
     @must_be_writable
     @synchronized
     def add_segment(self, blocks, pos, size):
@@ -900,9 +907,19 @@ class ArvadosFileWriter(ArvadosFileReader):
         for s in seq:
             self.write(s, num_retries)
 
+    @_FileLikeObjectBase._before_close
     def truncate(self, size=None):
         if size is None:
             size = self._filepos
         self.arvadosfile.truncate(size)
         if self._filepos > self.size():
             self._filepos = self.size()
+
+    @_FileLikeObjectBase._before_close
+    def flush(self):
+        self.arvadosfile.flush()
+
+    @_FileLikeObjectBase._before_close
+    def close(self):
+        self.flush()
+        super(ArvadosFileWriter, self).close()
diff --git a/sdk/python/arvados/collection.py b/sdk/python/arvados/collection.py
index 4d2a9ba..b0cdd92 100644
--- a/sdk/python/arvados/collection.py
+++ b/sdk/python/arvados/collection.py
@@ -1187,6 +1187,11 @@ class Collection(SynchronizedCollectionBase):
             self._block_manager.stop_threads()
 
     @synchronized
+    def manifest_locator(self):
+        """Get the manifest locator.  May be None."""
+        return self._manifest_locator
+
+    @synchronized
     def clone(self, new_parent=None, readonly=False, new_config=None):
         if new_config is None:
             new_config = self._config
diff --git a/sdk/python/arvados/errors.py b/sdk/python/arvados/errors.py
index 7a5c0ea..f6681d6 100644
--- a/sdk/python/arvados/errors.py
+++ b/sdk/python/arvados/errors.py
@@ -16,45 +16,46 @@ class ApiError(apiclient_errors.HttpError):
 
 class KeepRequestError(Exception):
     """Base class for errors accessing Keep services."""
-    def __init__(self, message='', service_errors=()):
-        """KeepRequestError(message='', service_errors=())
+    def __init__(self, message='', request_errors=(), label=""):
+        """KeepRequestError(message='', request_errors=())
 
         :message:
           A human-readable message describing what Keep operation
           failed.
 
-        :service_errors:
-          An iterable that yields 2-tuples of Keep
-          service URLs to the error encountered when talking to
-          it--either an exception, or an HTTP response object.  These
-          will be packed into an OrderedDict, available through the
-          service_errors() method.
+        :request_errors:
+          An iterable that yields 2-tuples of keys (where the key refers to
+          some operation that was attempted) to the error encountered when
+          talking to it--either an exception, or an HTTP response object.
+          These will be packed into an OrderedDict, available through the
+          request_errors() method.
 
         """
-        self._service_errors = OrderedDict(service_errors)
-        if self._service_errors:
+        self.label = label
+        self._request_errors = OrderedDict(request_errors)
+        if self._request_errors:
             exc_reports = [self._format_error(*err_pair)
-                           for err_pair in self._service_errors.iteritems()]
+                           for err_pair in self._request_errors.iteritems()]
             base_msg = "{}: {}".format(message, "; ".join(exc_reports))
         else:
             base_msg = message
         super(KeepRequestError, self).__init__(base_msg)
         self.message = message
 
-    def _format_error(self, service_root, error):
+    def _format_error(self, key, error):
         if isinstance(error, requests.Response):
-            err_fmt = "{} responded with {e.status_code} {e.reason}"
+            err_fmt = "{} {} responded with {e.status_code} {e.reason}"
         else:
-            err_fmt = "{} raised {e.__class__.__name__} ({e})"
-        return err_fmt.format(service_root, e=error)
+            err_fmt = "{} {} raised {e.__class__.__name__} ({e})"
+        return err_fmt.format(self.label, key, e=error)
 
-    def service_errors(self):
-        """service_errors() -> OrderedDict
+    def request_errors(self):
+        """request_errors() -> OrderedDict
 
-        The keys of the dictionary are Keep service URLs.
+        The keys of the dictionary are described by `self.label`
         The corresponding value is the exception raised when sending the
         request to it."""
-        return self._service_errors
+        return self._request_errors
 
 
 class ArgumentError(Exception):
diff --git a/sdk/python/arvados/keep.py b/sdk/python/arvados/keep.py
index 19c2252..8d0a89d 100644
--- a/sdk/python/arvados/keep.py
+++ b/sdk/python/arvados/keep.py
@@ -698,7 +698,7 @@ class KeepClient(object):
                 "{} not found".format(loc_s), service_errors)
         else:
             raise arvados.errors.KeepReadError(
-                "failed to read {}".format(loc_s), service_errors)
+                "failed to read {}".format(loc_s), service_errors, label="service")
 
     @retry.retry_method
     def put(self, data, copies=2, num_retries=None):
@@ -775,7 +775,7 @@ class KeepClient(object):
                               if not roots_map[key].success_flag)
             raise arvados.errors.KeepWriteError(
                 "failed to write {} (wanted {} copies but wrote {})".format(
-                    data_hash, copies, thread_limiter.done()), service_errors)
+                    data_hash, copies, thread_limiter.done()), service_errors, label="service")
 
     def local_store_put(self, data, copies=1, num_retries=None):
         """A stub for put().
diff --git a/sdk/python/arvados/stream.py b/sdk/python/arvados/stream.py
index 31638a0..3a42aa0 100644
--- a/sdk/python/arvados/stream.py
+++ b/sdk/python/arvados/stream.py
@@ -62,13 +62,10 @@ class StreamReader(object):
     def all_files(self):
         return self._files.values()
 
-    def _size(self):
+    def size(self):
         n = self._data_locators[-1]
         return n.range_start + n.range_size
 
-    def size(self):
-        return self._size()
-
     def locators_and_ranges(self, range_start, range_size):
         return locators_and_ranges(self._data_locators, range_start, range_size)
 
diff --git a/sdk/python/tests/test_arvfile.py b/sdk/python/tests/test_arvfile.py
index e63cf85..f50c446 100644
--- a/sdk/python/tests/test_arvfile.py
+++ b/sdk/python/tests/test_arvfile.py
@@ -77,10 +77,10 @@ class ArvadosFileWriterTestCase(unittest.TestCase):
             writer.seek(0, os.SEEK_SET)
             self.assertEqual("01234567", writer.read(12))
 
-            self.assertEqual(None, c._manifest_locator)
+            self.assertEqual(None, c.manifest_locator())
             self.assertEqual(True, c.modified())
             c.save_new("test_truncate")
-            self.assertEqual("zzzzz-4zz18-mockcollection0", c._manifest_locator)
+            self.assertEqual("zzzzz-4zz18-mockcollection0", c.manifest_locator())
             self.assertEqual(False, c.modified())
 
     def test_write_to_end(self):
@@ -104,12 +104,12 @@ class ArvadosFileWriterTestCase(unittest.TestCase):
             writer.seek(5, os.SEEK_SET)
             self.assertEqual("56789foo", writer.read(8))
 
-            self.assertEqual(None, c._manifest_locator)
+            self.assertEqual(None, c.manifest_locator())
             self.assertEqual(True, c.modified())
             self.assertEqual(None, keep.get("acbd18db4cc2f85cedef654fccc4a4d8+3"))
 
             c.save_new("test_append")
-            self.assertEqual("zzzzz-4zz18-mockcollection0", c._manifest_locator)
+            self.assertEqual("zzzzz-4zz18-mockcollection0", c.manifest_locator())
             self.assertEqual(False, c.modified())
             self.assertEqual("foo", keep.get("acbd18db4cc2f85cedef654fccc4a4d8+3"))
 
@@ -142,6 +142,13 @@ class ArvadosFileWriterTestCase(unittest.TestCase):
             self.assertEqual("foo3456789", writer.readfrom(0, 13))
             self.assertEqual(". acbd18db4cc2f85cedef654fccc4a4d8+3 781e5e245d69b566979b86e28d23f2c7+10 0:3:count.txt 6:7:count.txt\n", c.manifest_text())
 
+    def test_write_empty(self):
+        keep = ArvadosFileWriterTestCase.MockKeep({})
+        with Collection(keep_client=keep) as c:
+            writer = c.open("count.txt", "w")
+            self.assertEqual(writer.size(), 0)
+            self.assertEqual(". d41d8cd98f00b204e9800998ecf8427e+0 0:0:count.txt\n", c.manifest_text())
+
     def test_write_in_middle(self):
         keep = ArvadosFileWriterTestCase.MockKeep({"781e5e245d69b566979b86e28d23f2c7+10": "0123456789"})
         with Collection('. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count.txt\n',
@@ -204,10 +211,10 @@ class ArvadosFileWriterTestCase(unittest.TestCase):
                 writer.write(text)
             self.assertEqual(writer.size(), 100000000)
 
-            self.assertEqual(None, c._manifest_locator)
+            self.assertEqual(None, c.manifest_locator())
             self.assertEqual(True, c.modified())
             c.save_new("test_write_large")
-            self.assertEqual("zzzzz-4zz18-mockcollection0", c._manifest_locator)
+            self.assertEqual("zzzzz-4zz18-mockcollection0", c.manifest_locator())
             self.assertEqual(False, c.modified())
 
     def test_rewrite_on_empty_file(self):
@@ -218,7 +225,11 @@ class ArvadosFileWriterTestCase(unittest.TestCase):
             for b in xrange(0, 10):
                 writer.seek(0, os.SEEK_SET)
                 writer.write("0123456789")
-            writer.arvadosfile._repack_writes()
+
+            self.assertEqual(writer.size(), 10)
+            self.assertEqual("0123456789", writer.readfrom(0, 20))
+            self.assertEqual(". 7a08b07e84641703e5f2c836aa59a170+100 90:10:count.txt\n", c.manifest_text())
+            writer.flush()
             self.assertEqual(writer.size(), 10)
             self.assertEqual("0123456789", writer.readfrom(0, 20))
             self.assertEqual(". 781e5e245d69b566979b86e28d23f2c7+10 0:10:count.txt\n", c.manifest_text())
@@ -231,7 +242,12 @@ class ArvadosFileWriterTestCase(unittest.TestCase):
             for b in xrange(0, 10):
                 writer.seek(10, os.SEEK_SET)
                 writer.write("abcdefghij")
-            writer.arvadosfile._repack_writes()
+
+            self.assertEqual(writer.size(), 20)
+            self.assertEqual("0123456789abcdefghij", writer.readfrom(0, 20))
+            self.assertEqual(". 781e5e245d69b566979b86e28d23f2c7+10 ae5f43bab79cf0be33f025fa97ae7398+100 0:10:count.txt 100:10:count.txt\n", c.manifest_text())
+
+            writer.arvadosfile.flush()
             self.assertEqual(writer.size(), 20)
             self.assertEqual("0123456789abcdefghij", writer.readfrom(0, 20))
             self.assertEqual(". 781e5e245d69b566979b86e28d23f2c7+10 a925576942e94b2ef57a066101b48876+10 0:20:count.txt\n", c.manifest_text())
@@ -244,7 +260,13 @@ class ArvadosFileWriterTestCase(unittest.TestCase):
             for b in xrange(0, 10):
                 writer.seek(5, os.SEEK_SET)
                 writer.write("abcdefghij")
-            writer.arvadosfile._repack_writes()
+
+            self.assertEqual(writer.size(), 15)
+            self.assertEqual("01234abcdefghij", writer.readfrom(0, 20))
+            self.assertEqual(". 781e5e245d69b566979b86e28d23f2c7+10 ae5f43bab79cf0be33f025fa97ae7398+100 0:5:count.txt 100:10:count.txt\n", c.manifest_text())
+
+            writer.arvadosfile.flush()
+
             self.assertEqual(writer.size(), 15)
             self.assertEqual("01234abcdefghij", writer.readfrom(0, 20))
             self.assertEqual(". 781e5e245d69b566979b86e28d23f2c7+10 a925576942e94b2ef57a066101b48876+10 0:5:count.txt 10:10:count.txt\n", c.manifest_text())
@@ -265,10 +287,10 @@ class ArvadosFileWriterTestCase(unittest.TestCase):
             writer.write("foo")
             self.assertEqual(writer.size(), 100000000)
 
-            self.assertEqual(None, c._manifest_locator)
+            self.assertEqual(None, c.manifest_locator())
             self.assertEqual(True, c.modified())
             c.save_new("test_write_large")
-            self.assertEqual("zzzzz-4zz18-mockcollection0", c._manifest_locator)
+            self.assertEqual("zzzzz-4zz18-mockcollection0", c.manifest_locator())
             self.assertEqual(False, c.modified())
 
     def test_create(self):
@@ -283,11 +305,11 @@ class ArvadosFileWriterTestCase(unittest.TestCase):
             writer.write("01234567")
             self.assertEqual(writer.size(), 8)
 
-            self.assertEqual(None, c._manifest_locator)
+            self.assertEqual(None, c.manifest_locator())
             self.assertEqual(True, c.modified())
             self.assertEqual(None, keep.get("2e9ec317e197819358fbc43afca7d837+8"))
             c.save_new("test_create")
-            self.assertEqual("zzzzz-4zz18-mockcollection0", c._manifest_locator)
+            self.assertEqual("zzzzz-4zz18-mockcollection0", c.manifest_locator())
             self.assertEqual(False, c.modified())
             self.assertEqual("01234567", keep.get("2e9ec317e197819358fbc43afca7d837+8"))
 
@@ -318,10 +340,10 @@ class ArvadosFileWriterTestCase(unittest.TestCase):
             writer.write("01234567")
             self.assertEqual(writer.size(), 8)
 
-            self.assertEqual(None, c._manifest_locator)
+            self.assertEqual(None, c.manifest_locator())
             self.assertEqual(True, c.modified())
             c.save_new("test_overwrite")
-            self.assertEqual("zzzzz-4zz18-mockcollection0", c._manifest_locator)
+            self.assertEqual("zzzzz-4zz18-mockcollection0", c.manifest_locator())
             self.assertEqual(False, c.modified())
 
     def test_file_not_found(self):
@@ -348,11 +370,11 @@ class ArvadosFileWriterTestCase(unittest.TestCase):
             self.assertEqual(w1.size(), 8)
             self.assertEqual(w2.size(), 8)
 
-            self.assertEqual(None, c._manifest_locator)
+            self.assertEqual(None, c.manifest_locator())
             self.assertEqual(True, c.modified())
             self.assertEqual(None, keep.get("2e9ec317e197819358fbc43afca7d837+8"))
             c.save_new("test_create_multiple")
-            self.assertEqual("zzzzz-4zz18-mockcollection0", c._manifest_locator)
+            self.assertEqual("zzzzz-4zz18-mockcollection0", c.manifest_locator())
             self.assertEqual(False, c.modified())
             self.assertEqual("01234567", keep.get("2e9ec317e197819358fbc43afca7d837+8"))
 
@@ -460,8 +482,10 @@ class ArvadosFileReadTestCase(unittest.TestCase, StreamRetryTestMixin):
                 n += k.size
             except ValueError:
                 pass
-        col = Collection(keep_client=self.keep_client())
-        col._my_block_manager().prefetch_enabled = False
+
+        blockmanager = arvados.arvfile._BlockManager(self.keep_client())
+        blockmanager.prefetch_enabled = False
+        col = Collection(keep_client=self.keep_client(), block_manager=blockmanager)
         af = ArvadosFile(col,
                          stream=stream,
                          segments=segments)
@@ -563,5 +587,5 @@ class BlockManagerTest(unittest.TestCase):
         bufferblock.append("foo")
         with self.assertRaises(arvados.errors.KeepWriteError) as err:
             blockmanager.commit_all()
-        self.assertEqual(str(err.exception), "Error writing some blocks: acbd18db4cc2f85cedef654fccc4a4d8+3 raised KeepWriteError (fail)")
+        self.assertEqual(str(err.exception), "Error writing some blocks: block acbd18db4cc2f85cedef654fccc4a4d8+3 raised KeepWriteError (fail)")
         self.assertEqual(bufferblock.state(), arvados.arvfile._BufferBlock.PENDING)
diff --git a/sdk/python/tests/test_collections.py b/sdk/python/tests/test_collections.py
index ff30a7b..8cf34f0 100644
--- a/sdk/python/tests/test_collections.py
+++ b/sdk/python/tests/test_collections.py
@@ -1077,7 +1077,7 @@ class CollectionCreateUpdateTest(run_test_server.TestCaseWithServers):
         c1 = self.create_count_txt()
         c1.save()
 
-        c2 = Collection(c1._manifest_locator)
+        c2 = Collection(c1.manifest_locator())
         with c2.open("count.txt", "w") as f:
             f.write("abcdefg")
 
@@ -1105,7 +1105,7 @@ class CollectionCreateUpdateTest(run_test_server.TestCaseWithServers):
         c1 = self.create_count_txt()
         c1.save()
 
-        c2 = arvados.collection.Collection(c1._manifest_locator)
+        c2 = arvados.collection.Collection(c1.manifest_locator())
         with c2.open("count.txt", "w") as f:
             f.write("abcdefg")
 
@@ -1123,7 +1123,7 @@ class CollectionCreateUpdateTest(run_test_server.TestCaseWithServers):
         with c1.open("count.txt", "w") as f:
             f.write("XYZ")
 
-        c2 = arvados.collection.Collection(c1._manifest_locator)
+        c2 = arvados.collection.Collection(c1.manifest_locator())
         with c2.open("count.txt", "w") as f:
             f.write("abcdefg")
 
diff --git a/sdk/python/tests/test_errors.py b/sdk/python/tests/test_errors.py
index cf06c84..6e8df96 100644
--- a/sdk/python/tests/test_errors.py
+++ b/sdk/python/tests/test_errors.py
@@ -7,7 +7,7 @@ import arvados.errors as arv_error
 import arvados_testutil as tutil
 
 class KeepRequestErrorTestCase(unittest.TestCase):
-    SERVICE_ERRORS = [
+    REQUEST_ERRORS = [
         ('http://keep1.zzzzz.example.org/', IOError("test IOError")),
         ('http://keep3.zzzzz.example.org/', MemoryError("test MemoryError")),
         ('http://keep5.zzzzz.example.org/', tutil.fake_requests_response(
@@ -19,41 +19,41 @@ class KeepRequestErrorTestCase(unittest.TestCase):
         test_exc = arv_error.KeepRequestError("test message", *args)
         self.assertEqual("test message", test_exc.message)
 
-    def test_get_message_with_service_errors(self):
-        self.check_get_message(self.SERVICE_ERRORS[:])
+    def test_get_message_with_request_errors(self):
+        self.check_get_message(self.REQUEST_ERRORS[:])
 
-    def test_get_message_without_service_errors(self):
+    def test_get_message_without_request_errors(self):
         self.check_get_message()
 
-    def check_get_service_errors(self, *args):
+    def check_get_request_errors(self, *args):
         expected = dict(args[0]) if args else {}
         test_exc = arv_error.KeepRequestError("test service exceptions", *args)
-        self.assertEqual(expected, test_exc.service_errors())
+        self.assertEqual(expected, test_exc.request_errors())
 
-    def test_get_service_errors(self):
-        self.check_get_service_errors(self.SERVICE_ERRORS[:])
+    def test_get_request_errors(self):
+        self.check_get_request_errors(self.REQUEST_ERRORS[:])
 
-    def test_get_service_errors_none(self):
-        self.check_get_service_errors({})
+    def test_get_request_errors_none(self):
+        self.check_get_request_errors({})
 
     def test_empty_exception(self):
         test_exc = arv_error.KeepRequestError()
         self.assertFalse(test_exc.message)
-        self.assertEqual({}, test_exc.service_errors())
+        self.assertEqual({}, test_exc.request_errors())
 
     def traceback_str(self, exc):
         return traceback.format_exception_only(type(exc), exc)[-1]
 
-    def test_traceback_str_without_service_errors(self):
+    def test_traceback_str_without_request_errors(self):
         message = "test plain traceback string"
         test_exc = arv_error.KeepRequestError(message)
         exc_report = self.traceback_str(test_exc)
         self.assertTrue(exc_report.startswith("KeepRequestError: "))
         self.assertIn(message, exc_report)
 
-    def test_traceback_str_with_service_errors(self):
+    def test_traceback_str_with_request_errors(self):
         message = "test traceback shows Keep services"
-        test_exc = arv_error.KeepRequestError(message, self.SERVICE_ERRORS[:])
+        test_exc = arv_error.KeepRequestError(message, self.REQUEST_ERRORS[:])
         exc_report = self.traceback_str(test_exc)
         self.assertTrue(exc_report.startswith("KeepRequestError: "))
         for expect_substr in [message, "raised IOError", "raised MemoryError",
@@ -62,7 +62,7 @@ class KeepRequestErrorTestCase(unittest.TestCase):
             self.assertIn(expect_substr, exc_report)
         # Assert the report maintains order of listed services.
         last_index = -1
-        for service_key, _ in self.SERVICE_ERRORS:
+        for service_key, _ in self.REQUEST_ERRORS:
             service_index = exc_report.find(service_key)
             self.assertGreater(service_index, last_index)
             last_index = service_index
diff --git a/sdk/python/tests/test_keep_client.py b/sdk/python/tests/test_keep_client.py
index 2ee9054..baae28e 100644
--- a/sdk/python/tests/test_keep_client.py
+++ b/sdk/python/tests/test_keep_client.py
@@ -402,7 +402,7 @@ class KeepClientServiceTestCase(unittest.TestCase, tutil.ApiClientMock):
                 self.assertRaises(exc_class) as err_check:
             getattr(keep_client, verb)(data)
         urls = [urlparse.urlparse(url)
-                for url in err_check.exception.service_errors()]
+                for url in err_check.exception.request_errors()]
         self.assertEqual([('keep0x' + c, aport) for c in '3eab2d5fc9681074'],
                          [(url.hostname, url.port) for url in urls])
 
@@ -419,7 +419,7 @@ class KeepClientServiceTestCase(unittest.TestCase, tutil.ApiClientMock):
         keep_client = arvados.KeepClient(api_client=api_client)
         with self.assertRaises(exc_class) as err_check:
             getattr(keep_client, verb)('d41d8cd98f00b204e9800998ecf8427e+0')
-        self.assertEqual(0, len(err_check.exception.service_errors()))
+        self.assertEqual(0, len(err_check.exception.request_errors()))
 
     def test_get_error_with_no_services(self):
         self.check_no_services_error('get', arvados.errors.KeepReadError)
@@ -438,7 +438,7 @@ class KeepClientServiceTestCase(unittest.TestCase, tutil.ApiClientMock):
                                        num_retries=3)
         self.assertEqual([403, 403], [
                 getattr(error, 'status_code', None)
-                for error in err_check.exception.service_errors().itervalues()])
+                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)
@@ -454,7 +454,7 @@ class KeepClientServiceTestCase(unittest.TestCase, tutil.ApiClientMock):
                 self.assertRaises(arvados.errors.KeepWriteError) as exc_check:
             keep_client = arvados.KeepClient(api_client=api_client)
             keep_client.put(data)
-        self.assertEqual(2, len(exc_check.exception.service_errors()))
+        self.assertEqual(2, len(exc_check.exception.request_errors()))
 
 
 class KeepClientRetryTestMixin(object):

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list