[ARVADOS] updated: 2fc2ce33d7b857d42be0cd94354e90933b84ff1b

git at public.curoverse.com git at public.curoverse.com
Wed May 13 11:44:00 EDT 2015


Summary of changes:
 sdk/python/arvados/arvfile.py    | 10 ++++++++--
 sdk/python/arvados/collection.py | 16 +++++++++++-----
 2 files changed, 19 insertions(+), 7 deletions(-)

       via  2fc2ce33d7b857d42be0cd94354e90933b84ff1b (commit)
      from  06d87aa4fe72ad86c94593e4909be08bad6acb35 (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 2fc2ce33d7b857d42be0cd94354e90933b84ff1b
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Wed May 13 11:48:44 2015 -0400

    3198: FuseMvDirBetweenCollectionsTest works

diff --git a/sdk/python/arvados/arvfile.py b/sdk/python/arvados/arvfile.py
index f23fb0a..835e53e 100644
--- a/sdk/python/arvados/arvfile.py
+++ b/sdk/python/arvados/arvfile.py
@@ -571,6 +571,12 @@ class _BlockManager(object):
                         pass
                     raise KeepWriteError("Error writing some blocks", err, label="block")
 
+        for k,v in items:
+            # flush again with wait=True to remove committed bufferblocks from
+            # the segments.
+            v.owner.flush(True)
+
+
     def block_prefetch(self, locator):
         """Initiate a background download of a block.
 
@@ -840,6 +846,7 @@ class ArvadosFile(object):
 
     @synchronized
     def flush(self, wait=True, num_retries=0):
+        """Flush bufferblocks to Keep."""
         if self.modified():
             if self._current_bblock and self._current_bblock.state() == _BufferBlock.WRITABLE:
                 self._repack_writes(num_retries)
@@ -905,11 +912,10 @@ class ArvadosFile(object):
 
     @must_be_writable
     @synchronized
-    def reparent(self, newparent, newname):
+    def _reparent(self, newparent, newname):
         self._modified = True
         self.flush()
         self.parent.remove(self.name)
-
         self.parent = newparent
         self.name = newname
         self.lock = self.parent.root_collection().lock
diff --git a/sdk/python/arvados/collection.py b/sdk/python/arvados/collection.py
index eb1449b..eea0717 100644
--- a/sdk/python/arvados/collection.py
+++ b/sdk/python/arvados/collection.py
@@ -643,7 +643,7 @@ class RichCollectionBase(CollectionBase):
         """Test if the collection (or any subcollection or file) has been modified."""
         if self._modified:
             return True
-        for k,v in self._items.items():
+        for v in self._items.values():
             if v.modified():
                 return True
         return False
@@ -770,7 +770,7 @@ class RichCollectionBase(CollectionBase):
 
         # Actually make the move or copy.
         if reparent:
-            source_obj.reparent(self, target_name)
+            source_obj._reparent(self, target_name)
             item = source_obj
         else:
             item = source_obj.clone(self, target_name)
@@ -1069,6 +1069,12 @@ class RichCollectionBase(CollectionBase):
     def __ne__(self, other):
         return not self.__eq__(other)
 
+    @synchronized
+    def flush(self):
+        """Flush bufferblocks to Keep."""
+        for e in self.values():
+            e.flush()
+
 
 class Collection(RichCollectionBase):
     """Represents the root of an Arvados Collection.
@@ -1560,13 +1566,13 @@ class Subcollection(RichCollectionBase):
 
     @must_be_writable
     @synchronized
-    def reparent(self, newparent, newname):
-        # XXX add flush()
+    def _reparent(self, newparent, newname):
+        self._modified = True
+        self.flush()
         self.parent.remove(self.name, recursive=True)
         self.parent = newparent
         self.name = newname
         self.lock = self.parent.root_collection().lock
-        self._modified = True
 
 
 class CollectionReader(Collection):

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list