[ARVADOS] updated: 2.1.0-1215-g99e0417c6

Git user git at public.arvados.org
Wed Aug 25 20:48:31 UTC 2021


Summary of changes:
 sdk/python/arvados/collection.py     | 8 ++++++++
 sdk/python/tests/test_collections.py | 5 +++++
 2 files changed, 13 insertions(+)

       via  99e0417c63802d24c3d9f9a36e436ef3f82c4d94 (commit)
      from  742be532b81e9f0fc9df32b77d395dd92c743f4d (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 99e0417c63802d24c3d9f9a36e436ef3f82c4d94
Author: Lucas Di Pentima <lucas.dipentima at curii.com>
Date:   Wed Aug 25 17:48:04 2021 -0300

    17696: Adds default storage classes usage to Collection class.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima at curii.com>

diff --git a/sdk/python/arvados/collection.py b/sdk/python/arvados/collection.py
index 50cb703a5..b93a82642 100644
--- a/sdk/python/arvados/collection.py
+++ b/sdk/python/arvados/collection.py
@@ -1347,6 +1347,14 @@ class Collection(RichCollectionBase):
             except (IOError, errors.SyntaxError) as e:
                 raise errors.ArgumentError("Error processing manifest text: %s", e)
 
+        if self._storage_classes_desired is None:
+            try:
+                self._storage_classes_desired = [
+                    k for k, v in self._my_api().config()['StorageClasses'].items() if v['Default']]
+            except KeyError:
+                # We're talking to an old cluster
+                pass
+
     def storage_classes_desired(self):
         return self._storage_classes_desired or []
 
diff --git a/sdk/python/tests/test_collections.py b/sdk/python/tests/test_collections.py
index f821ff952..3a532c330 100644
--- a/sdk/python/tests/test_collections.py
+++ b/sdk/python/tests/test_collections.py
@@ -908,6 +908,11 @@ class NewCollectionTestCase(unittest.TestCase, CollectionTestMixin):
         self.assertEqual(c1.manifest_text, c2.manifest_text)
         self.assertNotEqual(c1.replication_desired, c2.replication_desired)
 
+    def test_storage_classes_uses_defaults_if_not_specified(self):
+        m = '. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt 0:10:count2.txt\n'
+        c1 = Collection(m, storage_classes_desired=None)
+        self.assertEqual(c1.storage_classes_desired(), ['default'])
+
     def test_storage_classes_desired_kept_on_load(self):
         m = '. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt 0:10:count2.txt\n'
         c1 = Collection(m, storage_classes_desired=['archival'])

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list