[ARVADOS] updated: 366173973595e6dcf09557156ace00c601deab85

git at public.curoverse.com git at public.curoverse.com
Thu Jan 21 04:01:42 EST 2016

Summary of changes:
 services/fuse/arvados_fuse/command.py |  3 +-
 services/fuse/arvados_fuse/fusedir.py |  3 +-
 services/fuse/tests/test_retry.py     | 65 ++++++++++++++---------------------
 3 files changed, 30 insertions(+), 41 deletions(-)

  discards  604ee58b314b217fed6cd49f3e8548acc2ae46ab (commit)
       via  366173973595e6dcf09557156ace00c601deab85 (commit)

This update added new revisions after undoing existing revisions.  That is
to say, the old revision is not a strict subset of the new revision.  This
situation occurs when you --force push a change and generate a repository
containing something like this:

 * -- * -- B -- O -- O -- O (604ee58b314b217fed6cd49f3e8548acc2ae46ab)
             N -- N -- N (366173973595e6dcf09557156ace00c601deab85)

When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.

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 366173973595e6dcf09557156ace00c601deab85
Author: Tom Clegg <tom at curoverse.com>
Date:   Thu Jan 21 04:01:16 2016 -0500

    8250: Fix arv-mount ignoring --retries argument when writing file data.
    "num_retries" arguments get passed around extensively in arvfile.py
    and collection.py in the Python SDK, but ultimately the writing of
    file data is done by a _BlockManager which doesn't have any way to
    accept that argument or pass it along to a KeepClient, so PUT requests
    always use the CollectionWriter's KeepClient's default num_retries.
    In arv-mount's case, we have been telling CollectionWriter the
    num_retries we want. When CollectionWriter creates a KeepClient,
    num_retries gets passed along -- normally this works around the fact
    that num_retries gets lost by the _BlockManager layer. However, we
    provided our own KeepClient to use instead of letting CollectionWriter
    create one, and we forgot to set num_retries on our own KeepClient, so
    we weren't retrying PUT requests.

diff --git a/services/fuse/arvados_fuse/command.py b/services/fuse/arvados_fuse/command.py
index cd81a53..71623a5 100644
--- a/services/fuse/arvados_fuse/command.py
+++ b/services/fuse/arvados_fuse/command.py
@@ -151,7 +151,8 @@ class Mount(object):
         self.api = arvados.safeapi.ThreadSafeApiCache(
-                "block_cache": arvados.keep.KeepBlockCache(self.args.file_cache)
+                'block_cache': arvados.keep.KeepBlockCache(self.args.file_cache),
+                'num_retries': self.args.retries,
         # Do a sanity check that we have a working arvados host + token.
diff --git a/services/fuse/arvados_fuse/fusedir.py b/services/fuse/arvados_fuse/fusedir.py
index a2135b3..7e627ef 100644
--- a/services/fuse/arvados_fuse/fusedir.py
+++ b/services/fuse/arvados_fuse/fusedir.py
@@ -493,7 +493,8 @@ class TmpCollectionDirectory(CollectionDirectoryBase):
     def __init__(self, parent_inode, inodes, api_client, num_retries):
         collection = self.UnsaveableCollection(
-            keep_client=api_client.keep)
+            keep_client=api_client.keep,
+            num_retries=num_retries)
         super(TmpCollectionDirectory, self).__init__(
             parent_inode, inodes, collection)
         self.collection_record_file = None
diff --git a/services/fuse/tests/test_retry.py b/services/fuse/tests/test_retry.py
new file mode 100644
index 0000000..f6c0807
--- /dev/null
+++ b/services/fuse/tests/test_retry.py
@@ -0,0 +1,35 @@
+import arvados
+import arvados_fuse.command
+import mock
+import os
+import run_test_server
+import tempfile
+import unittest
+class KeepClientRetry(unittest.TestCase):
+    origKeepClient = arvados.keep.KeepClient
+    def setUp(self):
+        self.mnt = tempfile.mkdtemp()
+        run_test_server.authorize_with('active')
+    def tearDown(self):
+        os.rmdir(self.mnt)
+    @mock.patch('arvados_fuse.arvados.keep.KeepClient')
+    def _test_retry(self, num_retries, argv, kc):
+        kc.side_effect = lambda *args, **kw: self.origKeepClient(*args, **kw)
+        with arvados_fuse.command.Mount(
+                arvados_fuse.command.ArgumentParser().parse_args(
+                    argv+[self.mnt])):
+            pass
+        self.assertEqual(num_retries, kc.call_args[1].get('num_retries'))
+    def test_default_retry_3(self):
+        self._test_retry(3, [])
+    def test_retry_2(self):
+        self._test_retry(2, ['--retries=2'])
+    def test_no_retry(self):
+        self._test_retry(0, ['--retries=0'])



More information about the arvados-commits mailing list