[ARVADOS] created: e86904aa647a984a04aea2c4ce20c61cae8ee9f5

Git user git at public.curoverse.com
Wed Oct 12 17:59:17 EDT 2016


        at  e86904aa647a984a04aea2c4ce20c61cae8ee9f5 (commit)


commit e86904aa647a984a04aea2c4ce20c61cae8ee9f5
Author: Lucas Di Pentima <lucas at curoverse.com>
Date:   Wed Oct 12 18:58:05 2016 -0300

    10243: Explicitly calling close(flush=False) on tests so that they work with this new feature.

diff --git a/sdk/python/tests/test_collections.py b/sdk/python/tests/test_collections.py
index 8d3e9d6..fc30a24 100644
--- a/sdk/python/tests/test_collections.py
+++ b/sdk/python/tests/test_collections.py
@@ -1110,13 +1110,16 @@ class NewCollectionTestCaseWithServers(run_test_server.TestCaseWithServers):
     def test_only_small_blocks_are_packed_together(self):
         c = Collection()
         # Write a couple of small files, 
-        with c.open("count.txt", "w") as f:
-            f.write("0123456789")
-        with c.open("foo.txt", "w") as foo:
-            foo.write("foo")
+        f = c.open("count.txt", "w")
+        f.write("0123456789")
+        f.close(flush=False)
+        foo = c.open("foo.txt", "w")
+        foo.write("foo")
+        foo.close(flush=False)
         # Then, write a big file, it shouldn't be packed with the ones above
-        with c.open("bigfile.txt", "w") as big:
-            big.write("x" * 1024 * 1024 * 33) # 33 MB > KEEP_BLOCK_SIZE/2
+        big = c.open("bigfile.txt", "w")
+        big.write("x" * 1024 * 1024 * 33) # 33 MB > KEEP_BLOCK_SIZE/2
+        big.close(flush=False)
         self.assertEqual(
             c.manifest_text("."),
             '. 2d303c138c118af809f39319e5d507e9+34603008 a8430a058b8fbf408e1931b794dbd6fb+13 0:34603008:bigfile.txt 34603008:10:count.txt 34603018:3:foo.txt\n')

commit daf793d506c68a45f50cca14d08182ee2ceeb0d1
Merge: eaefa56 29389ea
Author: Lucas Di Pentima <lucas at curoverse.com>
Date:   Wed Oct 12 18:42:17 2016 -0300

    Merge branch 'master' into 10243-make-packing-optional


commit eaefa56b27792e89eed272913fa30cdb4e6d0e70
Author: Lucas Di Pentima <lucas at curoverse.com>
Date:   Wed Oct 12 18:20:11 2016 -0300

    10243: Added a flush=True parameter to ArvadosFileWriter.close() so that the repacking feature is disabled by default.

diff --git a/sdk/python/arvados/arvfile.py b/sdk/python/arvados/arvfile.py
index 1ca7ad8..c394dab 100644
--- a/sdk/python/arvados/arvfile.py
+++ b/sdk/python/arvados/arvfile.py
@@ -834,14 +834,14 @@ class ArvadosFile(object):
             self._writers.add(writer)
 
     @synchronized
-    def remove_writer(self, writer):
+    def remove_writer(self, writer, flush):
         """
         Called from ArvadosFileWriter.close(). Remove a writer reference from the list
         and do some block maintenance tasks.
         """
         self._writers.remove(writer)
 
-        if self.size() > config.KEEP_BLOCK_SIZE / 2:
+        if flush or self.size() > config.KEEP_BLOCK_SIZE / 2:
             # File writer closed, not small enough for repacking
             self.flush()
         elif self.closed():
@@ -1166,7 +1166,7 @@ class ArvadosFileWriter(ArvadosFileReader):
     def flush(self):
         self.arvadosfile.flush()
 
-    def close(self):
+    def close(self, flush=True):
         if not self.closed:
-            self.arvadosfile.remove_writer(self)
+            self.arvadosfile.remove_writer(self, flush)
             super(ArvadosFileWriter, self).close()

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list