[ARVADOS] updated: 1.1.4-286-g287d269
Git user
git at public.curoverse.com
Tue May 22 12:26:33 EDT 2018
Summary of changes:
sdk/python/arvados/collection.py | 19 +++++++++++++++++++
sdk/python/tests/test_collections.py | 9 +++++++--
2 files changed, 26 insertions(+), 2 deletions(-)
via 287d269fa0ea5740715bfa6d3e93b44bea3b8584 (commit)
via da7f8e2cfc9434f86bd7672aee5e3b3bcd513ba6 (commit)
from f0d40c15b43521997703ba081f8ebded80a6e948 (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 287d269fa0ea5740715bfa6d3e93b44bea3b8584
Author: Fuad Muhic <muhic.fuad at gmail.com>
Date: Tue May 22 18:08:36 2018 +0200
Updated save method of Collection class to always update when
storage_classes is specified.
Arvados-DCO-1.1-Signed-off-by: Fuad Muhic <fmuhic at capeannenterprises.com>
diff --git a/sdk/python/arvados/collection.py b/sdk/python/arvados/collection.py
index fad2800..376e059 100644
--- a/sdk/python/arvados/collection.py
+++ b/sdk/python/arvados/collection.py
@@ -1458,6 +1458,7 @@ class Collection(RichCollectionBase):
Retry count on API calls (if None, use the collection default)
"""
+
if not self.committed():
if not self._has_collection_uuid():
raise AssertionError("Collection manifest_locator is not a collection uuid. Use save_new() for new collections.")
@@ -1482,6 +1483,14 @@ class Collection(RichCollectionBase):
self._manifest_text = self._api_response["manifest_text"]
self._portable_data_hash = self._api_response["portable_data_hash"]
self.set_committed(True)
+ elif storage_classes:
+ if type(storage_classes) is not list:
+ raise errors.ArgumentError("storage_classes must be list type.")
+ self._remember_api_response(self._my_api().collections().update(
+ uuid=self._manifest_locator,
+ body={"storage_classes_desired": storage_classes}
+ ).execute(
+ num_retries=num_retries))
return self._manifest_text
commit da7f8e2cfc9434f86bd7672aee5e3b3bcd513ba6
Author: Fuad Muhic <muhic.fuad at gmail.com>
Date: Tue May 22 17:40:15 2018 +0200
Added tests and documentation for save and save_new methods in
Collection class.
Arvados-DCO-1.1-Signed-off-by: Fuad Muhic <fmuhic at capeannenterprises.com>
diff --git a/sdk/python/arvados/collection.py b/sdk/python/arvados/collection.py
index cce7d75..fad2800 100644
--- a/sdk/python/arvados/collection.py
+++ b/sdk/python/arvados/collection.py
@@ -1447,6 +1447,9 @@ class Collection(RichCollectionBase):
the API server. If you want to save a manifest to Keep only, see
`save_new()`.
+ :storage_classes:
+ Specify desirable storage classes to be used when writing data to Keep.
+
:merge:
Update and merge remote changes before saving. Otherwise, any
remote changes will be ignored and overwritten.
@@ -1467,6 +1470,8 @@ class Collection(RichCollectionBase):
text = self.manifest_text(strip=False)
body={'manifest_text': text}
if storage_classes:
+ if type(storage_classes) is not list:
+ raise errors.ArgumentError("storage_classes must be list type.")
body["storage_classes_desired"] = storage_classes
self._remember_api_response(self._my_api().collections().update(
@@ -1508,6 +1513,9 @@ class Collection(RichCollectionBase):
the user, or project uuid that will own this collection.
If None, defaults to the current user.
+ :storage_classes:
+ Specify desirable storage classes to be used when writing data to Keep.
+
:ensure_unique_name:
If True, ask the API server to rename the collection
if it conflicts with a collection with the same name and owner. If
@@ -1531,6 +1539,8 @@ class Collection(RichCollectionBase):
if owner_uuid:
body["owner_uuid"] = owner_uuid
if storage_classes:
+ if type(storage_classes) is not list:
+ raise errors.ArgumentError("storage_classes must be list type.")
body["storage_classes_desired"] = storage_classes
self._remember_api_response(self._my_api().collections().create(ensure_unique_name=ensure_unique_name, body=body).execute(num_retries=num_retries))
diff --git a/sdk/python/tests/test_collections.py b/sdk/python/tests/test_collections.py
index 49c0019..736994c 100644
--- a/sdk/python/tests/test_collections.py
+++ b/sdk/python/tests/test_collections.py
@@ -1300,17 +1300,22 @@ class CollectionCreateUpdateTest(run_test_server.TestCaseWithServers):
def test_create_and_save(self):
c = self.create_count_txt()
- c.save()
+ c.save(storage_classes=['archive'])
+
self.assertRegex(
c.manifest_text(),
r"^\. 781e5e245d69b566979b86e28d23f2c7\+10\+A[a-f0-9]{40}@[a-f0-9]{8} 0:10:count\.txt$",)
+ self.assertEqual(c.api_response()["storage_classes_desired"], ['archive'])
+
def test_create_and_save_new(self):
c = self.create_count_txt()
- c.save_new()
+ c.save_new(storage_classes=['archive'])
+
self.assertRegex(
c.manifest_text(),
r"^\. 781e5e245d69b566979b86e28d23f2c7\+10\+A[a-f0-9]{40}@[a-f0-9]{8} 0:10:count\.txt$",)
+ self.assertEqual(c.api_response()["storage_classes_desired"], ['archive'])
def test_create_diff_apply(self):
c1 = self.create_count_txt()
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list