[ARVADOS] updated: 679eef491b59a4c38a0b2914ff85e0a8c5059b2c
git at public.curoverse.com
git at public.curoverse.com
Mon Apr 13 11:23:13 EDT 2015
Summary of changes:
sdk/python/arvados/collection.py | 41 ++++++++++++++++++++++++------------
sdk/python/tests/test_collections.py | 2 +-
2 files changed, 29 insertions(+), 14 deletions(-)
via 679eef491b59a4c38a0b2914ff85e0a8c5059b2c (commit)
from c162a42573cdce83a35c54e630622544404012f7 (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 679eef491b59a4c38a0b2914ff85e0a8c5059b2c
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Mon Apr 13 11:23:09 2015 -0400
5692: Move implementation to internal _get_manifest_text(). Fix typos.
diff --git a/sdk/python/arvados/collection.py b/sdk/python/arvados/collection.py
index 82931f4..11eb666 100644
--- a/sdk/python/arvados/collection.py
+++ b/sdk/python/arvados/collection.py
@@ -825,21 +825,20 @@ class RichCollectionBase(CollectionBase):
def portable_manifest_text(self, stream_name="."):
"""Get the manifest text for this collection, sub collections and files.
- This method does not flush outstanding to Keep. It will return a
- normalized manifest with access tokens stripped.
+ This method does not flush outstanding blocks to Keep. It will return
+ a normalized manifest with access tokens stripped.
:stream_name:
Name to use for this stream (directory)
"""
- return self.manifest_text(stream_name, strip=True, normalize=True, flush=False)
+ return self._get_manifest_text(stream_name, True, True)
- @synchronized
- def manifest_text(self, stream_name=".", strip=False, normalize=False, flush=True):
+ def manifest_text(self, stream_name=".", strip=False, normalize=False):
"""Get the manifest text for this collection, sub collections and files.
- By default, this method will flush outstanding blocksto Keep. By
- default it will not normalize the manifest or strip access tokens.
+ This method will flush outstanding blocks to Keep. By default, it will
+ not normalize an unmodified manifest or strip access tokens.
:stream_name:
Name to use for this stream (directory)
@@ -854,15 +853,31 @@ class RichCollectionBase(CollectionBase):
is not modified, return the original manifest text even if it is not
in normalized form.
- :flush:
- If true (default) write any outstanding blocks.
+ """
+
+ self._my_block_manager().commit_all()
+ return self._get_manifest_text(stream_name, strip, normalize)
+
+ @synchronized
+ def _get_manifest_text(self, stream_name, strip, normalize):
+ """Get the manifest text for this collection, sub collections and files.
+
+ :stream_name:
+ Name to use for this stream (directory)
+
+ :strip:
+ If True, remove signing tokens from block locators if present.
+ If False (default), block locators are left unchanged.
+
+ :normalize:
+ If True, always export the manifest text in normalized form
+ even if the Collection is not modified. If False (default) and the collection
+ is not modified, return the original manifest text even if it is not
+ in normalized form.
"""
if self.modified() or self._manifest_text is None or normalize:
- if flush:
- self._my_block_manager().commit_all()
-
stream = {}
buf = []
sorted_keys = sorted(self.keys())
@@ -882,7 +897,7 @@ class RichCollectionBase(CollectionBase):
if stream:
buf.append(" ".join(normalize_stream(stream_name, stream)) + "\n")
for dirname in [s for s in sorted_keys if isinstance(self[s], RichCollectionBase)]:
- buf.append(self[dirname].manifest_text(stream_name=os.path.join(stream_name, dirname), strip=strip))
+ buf.append(self[dirname].manifest_text(stream_name=os.path.join(stream_name, dirname), strip=strip, normalize=True))
return "".join(buf)
else:
if strip:
diff --git a/sdk/python/tests/test_collections.py b/sdk/python/tests/test_collections.py
index 8310de2..68ba8b7 100644
--- a/sdk/python/tests/test_collections.py
+++ b/sdk/python/tests/test_collections.py
@@ -1097,7 +1097,7 @@ class CollectionCreateUpdateTest(run_test_server.TestCaseWithServers):
c.apply(diff)
- self.assertEqual(c.manifest_text(flush=False), ". 7ac66c0f148de9519b8bd264312c4d64+7+A715fd31f8111894f717eb1003c1b0216799dd9ec at 54f5dd1a 0:7:count.txt\n")
+ self.assertEqual(c._get_manifest_text(".", False, True), ". 7ac66c0f148de9519b8bd264312c4d64+7+A715fd31f8111894f717eb1003c1b0216799dd9ec at 54f5dd1a 0:7:count.txt\n")
def test_create_and_update(self):
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list