[ARVADOS] updated: 9f0f926aa45113a50ed1de737b236e9f69f64079

git at public.curoverse.com git at public.curoverse.com
Fri Feb 6 13:47:06 EST 2015


Summary of changes:
 sdk/python/arvados/collection.py                      | 11 ++++++-----
 sdk/python/arvados/commands/put.py                    |  6 +++++-
 sdk/python/arvados/keep.py                            |  9 +++++----
 services/api/app/models/collection.rb                 | 18 ++++++++++++------
 .../arvados/v1/collections_controller_test.rb         | 19 +++++++++++++++++++
 services/api/test/unit/collection_test.rb             | 10 ++++++++++
 6 files changed, 57 insertions(+), 16 deletions(-)

       via  9f0f926aa45113a50ed1de737b236e9f69f64079 (commit)
       via  1a78ca155b741a08fcf8e0e284bc4da273f084c2 (commit)
       via  4204a3c2bda7378e8664233d3c2410c5efb95a47 (commit)
       via  1147248aa7a30a9a423e7b5b30c6bbb7d4b9bba6 (commit)
      from  cbf80c08daa5f9099d0821603a128967254709ed (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 9f0f926aa45113a50ed1de737b236e9f69f64079
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Feb 6 13:42:00 2015 -0500

    5011: Make docstring less scary.

diff --git a/sdk/python/arvados/collection.py b/sdk/python/arvados/collection.py
index 18e9e63..7bfdf78 100644
--- a/sdk/python/arvados/collection.py
+++ b/sdk/python/arvados/collection.py
@@ -560,11 +560,12 @@ class CollectionWriter(CollectionBase):
     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.
+        This is useful for storing manifest fragments (task outputs)
+        temporarily in Keep during a Crunch job.
+
+        In other 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)
 

commit 1a78ca155b741a08fcf8e0e284bc4da273f084c2
Author: Tom Clegg <tom at curoverse.com>
Date:   Thu Feb 5 16:22:20 2015 -0500

    5011: Add forward compatibility, so we don't need backward compatibility later.

diff --git a/sdk/python/arvados/commands/put.py b/sdk/python/arvados/commands/put.py
index bbe1d81..4383514 100644
--- a/sdk/python/arvados/commands/put.py
+++ b/sdk/python/arvados/commands/put.py
@@ -479,13 +479,17 @@ def main(arguments=None, stdout=sys.stdout, stderr=sys.stderr):
             manifest_text = writer.manifest_text()
             if args.normalize:
                 manifest_text = CollectionReader(manifest_text).manifest_text(normalize=True)
+            replication_attr = 'replication_desired'
+            if api_client._schema.schemas['Collection']['properties'].get(replication_attr, None) is None:
+                # API calls it 'redundancy' until #3410.
+                replication_attr = 'redundancy'
             # Register the resulting collection in Arvados.
             collection = api_client.collections().create(
                 body={
                     'owner_uuid': project_uuid,
                     'name': collection_name,
                     'manifest_text': manifest_text,
-                    'redundancy': args.replication,
+                    replication_attr: args.replication,
                     },
                 ensure_unique_name=True
                 ).execute(num_retries=args.retries)

commit 4204a3c2bda7378e8664233d3c2410c5efb95a47
Author: Tom Clegg <tom at curoverse.com>
Date:   Thu Feb 5 15:15:22 2015 -0500

    5011: Add tests and comments for redundancy vs. replication_desired attrs.

diff --git a/services/api/app/models/collection.rb b/services/api/app/models/collection.rb
index cd334d5..76d5dc6 100644
--- a/services/api/app/models/collection.rb
+++ b/services/api/app/models/collection.rb
@@ -25,12 +25,18 @@ class Collection < ArvadosModel
   end
 
   def self.attributes_required_columns
-    # If we don't list this explicitly, the params[:select] code gets
-    # confused by the way we expose signed_manifest_text as
-    # manifest_text in the API response, and never let clients select
-    # the manifest_text column.
-    super.merge('manifest_text' => ['manifest_text'],
-                'replication_desired' => ['redundancy'])
+    super.merge(
+                # If we don't list manifest_text explicitly, the
+                # params[:select] code gets confused by the way we
+                # expose signed_manifest_text as manifest_text in the
+                # API response, and never let clients select the
+                # manifest_text column.
+                'manifest_text' => ['manifest_text'],
+
+                # This is a shim until the database column gets
+                # renamed to replication_desired in #3410.
+                'replication_desired' => ['redundancy'],
+                )
   end
 
   def check_signatures
diff --git a/services/api/test/functional/arvados/v1/collections_controller_test.rb b/services/api/test/functional/arvados/v1/collections_controller_test.rb
index c65ae2f..c3b5303 100644
--- a/services/api/test/functional/arvados/v1/collections_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/collections_controller_test.rb
@@ -695,4 +695,23 @@ EOS
       assert_response expected_response
     end
   end
+
+  [1, 5, nil].each do |ask|
+    test "Set replication_desired=#{ask} using redundancy attr" do
+      # The Python SDK checks the Collection schema in the discovery
+      # doc, then asks for 'redundancy' or 'replication_desired'
+      # accordingly, so it isn't necessary to maintain backward
+      # compatibility here when the attribute changes to
+      # replication_desired.
+      authorize_with :active
+      put :update, {
+        id: collections(:collection_owned_by_active).uuid,
+        collection: {
+          redundancy: ask,
+        },
+      }
+      assert_response :success
+      assert_equal (ask or 2), json_response['replication_desired']
+    end
+  end
 end
diff --git a/services/api/test/unit/collection_test.rb b/services/api/test/unit/collection_test.rb
index 16d041b..1386a25 100644
--- a/services/api/test/unit/collection_test.rb
+++ b/services/api/test/unit/collection_test.rb
@@ -81,4 +81,14 @@ class CollectionTest < ActiveSupport::TestCase
       end
     end
   end
+
+  [0, 2, 4, nil].each do |ask|
+    test "replication_desired reports #{ask or 2} if redundancy is #{ask}" do
+      act_as_user users(:active) do
+        c = collections(:collection_owned_by_active)
+        c.update_attributes redundancy: ask
+        assert_equal (ask or 2), c.replication_desired
+      end
+    end
+  end
 end

commit 1147248aa7a30a9a423e7b5b30c6bbb7d4b9bba6
Author: Tom Clegg <tom at curoverse.com>
Date:   Thu Feb 5 15:14:49 2015 -0500

    5011: Fix up docstring.

diff --git a/sdk/python/arvados/keep.py b/sdk/python/arvados/keep.py
index 8a27574..f98f899 100644
--- a/sdk/python/arvados/keep.py
+++ b/sdk/python/arvados/keep.py
@@ -737,14 +737,16 @@ class KeepClient(object):
                     data_hash, copies, thread_limiter.done()), service_errors)
 
     def local_store_put(self, data, copies=1, num_retries=None):
-        """A stub for put(), for use in test cases.
+        """A stub for put().
+
+        This method is used in place of the real put() method in a
+        KeepClient constructed with local_store=True.
 
         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))
@@ -755,8 +757,7 @@ class KeepClient(object):
         return locator
 
     def local_store_get(self, loc_s, num_retries=None):
-        """Companion to local_store_put(), for use in test cases.
-        """
+        """Companion to local_store_put()."""
         try:
             locator = KeepLocator(loc_s)
         except ValueError:

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list