[ARVADOS] updated: a2e9008a5fcd7669d5cdd33021212ac754288d19
git at public.curoverse.com
git at public.curoverse.com
Wed Feb 4 11:24:34 EST 2015
Summary of changes:
sdk/python/arvados/commands/put.py | 7 ++++++-
sdk/python/tests/test_arv_put.py | 20 ++++++++++++--------
services/api/app/models/collection.rb | 9 ++++++++-
3 files changed, 26 insertions(+), 10 deletions(-)
via a2e9008a5fcd7669d5cdd33021212ac754288d19 (commit)
via 0507f73ce83c4a53ce8734f21635928a18d228ad (commit)
via cb6a13cdda9c9b8e2c1dbb151c432ec109e14c82 (commit)
from 655b69e4285476fbd9df4a88ea53e02ea93fa349 (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 a2e9008a5fcd7669d5cdd33021212ac754288d19
Author: Tom Clegg <tom at curoverse.com>
Date: Sat Jan 31 03:52:51 2015 -0500
5011: 3410: Export client-specified redundancy as replication_desired.
diff --git a/sdk/python/tests/test_arv_put.py b/sdk/python/tests/test_arv_put.py
index 9d19e8d..196264f 100644
--- a/sdk/python/tests/test_arv_put.py
+++ b/sdk/python/tests/test_arv_put.py
@@ -535,11 +535,11 @@ class ArvPutIntegrationTest(run_test_server.TestCaseWithServers,
# making sure collections.create tells the API server what our
# desired replication level is.
collection = self.run_and_find_collection("", ['--replication', '4'])
- self.assertEqual(4, collection['redundancy'])
+ self.assertEqual(4, collection['replication_desired'])
def test_put_collection_with_default_redundancy(self):
collection = self.run_and_find_collection("")
- self.assertEqual(2, collection['redundancy'])
+ self.assertEqual(2, collection['replication_desired'])
def test_put_collection_with_unnamed_project_link(self):
link = self.run_and_find_collection(
diff --git a/services/api/app/models/collection.rb b/services/api/app/models/collection.rb
index 457fb5f..cd334d5 100644
--- a/services/api/app/models/collection.rb
+++ b/services/api/app/models/collection.rb
@@ -21,6 +21,7 @@ class Collection < ArvadosModel
t.add :properties
t.add :portable_data_hash
t.add :signed_manifest_text, as: :manifest_text
+ t.add :replication_desired
end
def self.attributes_required_columns
@@ -28,7 +29,8 @@ class Collection < ArvadosModel
# 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'])
+ super.merge('manifest_text' => ['manifest_text'],
+ 'replication_desired' => ['redundancy'])
end
def check_signatures
@@ -175,6 +177,11 @@ class Collection < ArvadosModel
end
end
+ def replication_desired
+ # Shim until database columns get fixed up in #3410.
+ redundancy or 2
+ end
+
def redundancy_status
if redundancy_confirmed_as.nil?
'unconfirmed'
commit 0507f73ce83c4a53ce8734f21635928a18d228ad
Author: Tom Clegg <tom at curoverse.com>
Date: Fri Jan 30 18:34:26 2015 -0500
5011: Fix run_and_find_collection so it works without --portable-data-hash.
diff --git a/sdk/python/tests/test_arv_put.py b/sdk/python/tests/test_arv_put.py
index d876877..9d19e8d 100644
--- a/sdk/python/tests/test_arv_put.py
+++ b/sdk/python/tests/test_arv_put.py
@@ -523,8 +523,10 @@ class ArvPutIntegrationTest(run_test_server.TestCaseWithServers,
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, env=self.ENVIRON)
stdout, stderr = pipe.communicate(text)
+ search_key = ('portable_data_hash'
+ if '--portable-data-hash' in extra_args else 'uuid')
collection_list = arvados.api('v1').collections().list(
- filters=[['portable_data_hash', '=', stdout.strip()]]).execute().get('items', [])
+ filters=[[search_key, '=', stdout.strip()]]).execute().get('items', [])
self.assertEqual(1, len(collection_list))
return collection_list[0]
@@ -536,12 +538,13 @@ class ArvPutIntegrationTest(run_test_server.TestCaseWithServers,
self.assertEqual(4, collection['redundancy'])
def test_put_collection_with_default_redundancy(self):
- collection = self.run_and_find_collection("", [])
+ collection = self.run_and_find_collection("")
self.assertEqual(2, collection['redundancy'])
def test_put_collection_with_unnamed_project_link(self):
- link = self.run_and_find_collection("Test unnamed collection",
- ['--portable-data-hash', '--project-uuid', self.PROJECT_UUID])
+ link = self.run_and_find_collection(
+ "Test unnamed collection",
+ ['--portable-data-hash', '--project-uuid', self.PROJECT_UUID])
username = pwd.getpwuid(os.getuid()).pw_name
self.assertRegexpMatches(
link['name'],
@@ -549,8 +552,9 @@ class ArvPutIntegrationTest(run_test_server.TestCaseWithServers,
def test_put_collection_with_name_and_no_project(self):
link_name = 'Test Collection Link in home project'
- collection = self.run_and_find_collection("Test named collection in home project",
- ['--portable-data-hash', '--name', link_name])
+ collection = self.run_and_find_collection(
+ "Test named collection in home project",
+ ['--portable-data-hash', '--name', link_name])
self.assertEqual(link_name, collection['name'])
my_user_uuid = self.current_user()['uuid']
self.assertEqual(my_user_uuid, collection['owner_uuid'])
commit cb6a13cdda9c9b8e2c1dbb151c432ec109e14c82
Author: Tom Clegg <tom at curoverse.com>
Date: Fri Jan 30 17:27:05 2015 -0500
5011: Use replication=2 if unspecified.
diff --git a/sdk/python/arvados/commands/put.py b/sdk/python/arvados/commands/put.py
index df91c6a..0148836 100644
--- a/sdk/python/arvados/commands/put.py
+++ b/sdk/python/arvados/commands/put.py
@@ -408,6 +408,11 @@ def main(arguments=None, stdout=sys.stdout, stderr=sys.stderr):
print >>stderr, error
sys.exit(1)
+ # Apply default replication, if none specified. TODO (#3410): Use
+ # default replication given by discovery document.
+ if args.replication <= 0:
+ args.replication = 2
+
if args.progress:
reporter = progress_writer(human_progress)
elif args.batch_progress:
@@ -480,7 +485,7 @@ def main(arguments=None, stdout=sys.stdout, stderr=sys.stderr):
'owner_uuid': project_uuid,
'name': collection_name,
'manifest_text': manifest_text,
- 'redundancy': replication,
+ 'redundancy': args.replication,
},
ensure_unique_name=True
).execute(num_retries=args.retries)
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list