[ARVADOS] updated: 9ae339f1aab32d8473f366c7aaa25633a5a49008
git at public.curoverse.com
git at public.curoverse.com
Wed Feb 4 13:57:33 EST 2015
Summary of changes:
sdk/python/arvados/collection.py | 20 +++++++++++---------
sdk/python/arvados/commands/put.py | 2 +-
sdk/python/arvados/keep.py | 18 +++++++++++++-----
3 files changed, 25 insertions(+), 15 deletions(-)
via 9ae339f1aab32d8473f366c7aaa25633a5a49008 (commit)
via 3d0c0753efb6e2b610d23d16038db218b491a70f (commit)
via 288413d1c5efcf5d207e0556962740a7759891a1 (commit)
from a2e9008a5fcd7669d5cdd33021212ac754288d19 (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 9ae339f1aab32d8473f366c7aaa25633a5a49008
Author: Tom Clegg <tom at curoverse.com>
Date: Wed Feb 4 13:56:45 2015 -0500
5011: Convert comment to docstring.
diff --git a/sdk/python/arvados/collection.py b/sdk/python/arvados/collection.py
index f56af6e..18e9e63 100644
--- a/sdk/python/arvados/collection.py
+++ b/sdk/python/arvados/collection.py
@@ -558,12 +558,14 @@ class CollectionWriter(CollectionBase):
self._current_file_name = None
def finish(self):
- # Store the manifest in Keep and return its locator. Beware,
- # this is only useful in special cases like storing manifest
- # fragments temporarily in Keep during a Crunch job. In most
- # cases you should make a collection instead, by sending
- # manifest_text() to the API server's "create collection"
- # endpoint.
+ """Store the manifest in Keep and return its locator.
+
+ Beware, this is only useful in special cases like storing
+ manifest fragments temporarily in Keep during a Crunch job. In
+ most cases you should make a collection instead, by sending
+ manifest_text() to the API server's "create collection"
+ endpoint.
+ """
return self._my_keep().put(self.manifest_text(), copies=self.replication)
def portable_data_hash(self):
commit 3d0c0753efb6e2b610d23d16038db218b491a70f
Author: Tom Clegg <tom at curoverse.com>
Date: Wed Feb 4 13:56:33 2015 -0500
5011: Sync local_store_put/get() signatures to put/get(). Add docstrings.
diff --git a/sdk/python/arvados/keep.py b/sdk/python/arvados/keep.py
index 4698789..8a27574 100644
--- a/sdk/python/arvados/keep.py
+++ b/sdk/python/arvados/keep.py
@@ -736,10 +736,16 @@ class KeepClient(object):
"failed to write {} (wanted {} copies but wrote {})".format(
data_hash, copies, thread_limiter.done()), service_errors)
- # Local storage methods need no-op num_retries arguments to keep
- # integration tests happy. With better isolation they could
- # probably be removed again.
- def local_store_put(self, data, num_retries=0, copies=1):
+ def local_store_put(self, data, copies=1, num_retries=None):
+ """A stub for put(), for use in test cases.
+
+ copies and num_retries arguments are ignored: they are here
+ only for the sake of offering the same call signature as
+ put().
+
+ Data stored this way can be retrieved via local_store_get().
+
+ """
md5 = hashlib.md5(data).hexdigest()
locator = '%s+%d' % (md5, len(data))
with open(os.path.join(self.local_store, md5 + '.tmp'), 'w') as f:
@@ -748,7 +754,9 @@ class KeepClient(object):
os.path.join(self.local_store, md5))
return locator
- def local_store_get(self, loc_s, num_retries=0, copies=1):
+ def local_store_get(self, loc_s, num_retries=None):
+ """Companion to local_store_put(), for use in test cases.
+ """
try:
locator = KeepLocator(loc_s)
except ValueError:
commit 288413d1c5efcf5d207e0556962740a7759891a1
Author: Tom Clegg <tom at curoverse.com>
Date: Wed Feb 4 13:54:37 2015 -0500
5011: Use None, not 0, to signify default replication.
diff --git a/sdk/python/arvados/collection.py b/sdk/python/arvados/collection.py
index 45ed093..f56af6e 100644
--- a/sdk/python/arvados/collection.py
+++ b/sdk/python/arvados/collection.py
@@ -304,7 +304,7 @@ class _WriterFile(ArvadosFileBase):
class CollectionWriter(CollectionBase):
KEEP_BLOCK_SIZE = 2**26
- def __init__(self, api_client=None, num_retries=0, replication=0):
+ def __init__(self, api_client=None, num_retries=0, replication=None):
"""Instantiate a CollectionWriter.
CollectionWriter lets you build a new Arvados Collection from scratch.
@@ -321,12 +321,12 @@ class CollectionWriter(CollectionBase):
after instantiation, but note those changes may not
propagate to related objects like the Keep client.
* replication: The number of copies of each block to store.
- If this argument is 0 or not supplied, replication is
+ If this argument is None or not supplied, replication is
the server-provided default if available, otherwise 2.
"""
self._api_client = api_client
self.num_retries = num_retries
- self.replication = (replication if replication>0 else 2)
+ self.replication = (2 if replication is None else replication)
self._keep_client = None
self._data_buffer = []
self._data_buffer_len = 0
diff --git a/sdk/python/arvados/commands/put.py b/sdk/python/arvados/commands/put.py
index 0148836..bbe1d81 100644
--- a/sdk/python/arvados/commands/put.py
+++ b/sdk/python/arvados/commands/put.py
@@ -110,7 +110,7 @@ Print the portable data hash instead of the Arvados UUID for the collection
created by the upload.
""")
-upload_opts.add_argument('--replication', type=int, metavar='N', default=0,
+upload_opts.add_argument('--replication', type=int, metavar='N', default=None,
help="""
Set the replication level for the new collection: how many different
physical storage devices (e.g., disks) should have a copy of each data
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list