[ARVADOS] created: 7e0f4ed52e26a60fa612016f56f787130cd41876
Git user
git at public.curoverse.com
Tue Apr 5 15:46:54 EDT 2016
at 7e0f4ed52e26a60fa612016f56f787130cd41876 (commit)
commit 7e0f4ed52e26a60fa612016f56f787130cd41876
Author: Brett Smith <brett at curoverse.com>
Date: Tue Apr 5 15:45:21 2016 -0400
8879: Clean indentation in CWL SDK tests.
diff --git a/sdk/cwl/tests/test_submit.py b/sdk/cwl/tests/test_submit.py
index d4b855c..4f3d04c 100644
--- a/sdk/cwl/tests/test_submit.py
+++ b/sdk/cwl/tests/test_submit.py
@@ -48,16 +48,16 @@ class TestSubmit(unittest.TestCase):
'runtime_constraints': {
'docker_image': 'arvados/jobs'
},
- 'script_parameters': {
- 'x': {
- 'path': '99999999999999999999999999999992+99/blorp.txt',
- 'class': 'File'
+ 'script_parameters': {
+ 'x': {
+ 'path': '99999999999999999999999999999992+99/blorp.txt',
+ 'class': 'File'
+ },
+ 'cwl:tool': '99999999999999999999999999999991+99/wf/submit_wf.cwl'
},
- 'cwl:tool': '99999999999999999999999999999991+99/wf/submit_wf.cwl'
- },
- 'repository': 'arvados',
+ 'repository': 'arvados',
'script_version': 'master',
- 'script': 'cwl-runner'
+ 'script': 'cwl-runner'
},
find_or_create=True)
commit 12caeadba0c90b6c77270bec33aa9af7d603909d
Author: Brett Smith <brett at curoverse.com>
Date: Tue Apr 5 15:37:35 2016 -0400
8879: cwl-runner --submit respects --project-uuid.
diff --git a/sdk/cwl/arvados_cwl/__init__.py b/sdk/cwl/arvados_cwl/__init__.py
index ab8d725..8f2102c 100644
--- a/sdk/cwl/arvados_cwl/__init__.py
+++ b/sdk/cwl/arvados_cwl/__init__.py
@@ -366,6 +366,7 @@ class RunnerJob(object):
self.job_order["cwl:tool"] = workflowmapper.mapper(self.tool.tool["id"])[1]
response = self.arvrunner.api.jobs().create(body={
+ "owner_uuid": self.arvrunner.project_uuid,
"script": "cwl-runner",
"script_version": "master",
"repository": "arvados",
diff --git a/sdk/cwl/tests/test_submit.py b/sdk/cwl/tests/test_submit.py
index 4e343b6..d4b855c 100644
--- a/sdk/cwl/tests/test_submit.py
+++ b/sdk/cwl/tests/test_submit.py
@@ -17,7 +17,8 @@ class TestSubmit(unittest.TestCase):
return "%s+%i" % (hashlib.md5(p).hexdigest(), len(p))
keep().put.side_effect = putstub
keepdocker.return_value = True
- api.users().current().execute.return_value = {"uuid": "zzzzz-tpzed-zzzzzzzzzzzzzzz"}
+ user_uuid = "zzzzz-tpzed-zzzzzzzzzzzzzzz"
+ api.users().current().execute.return_value = {"uuid": user_uuid}
api.collections().list().execute.return_value = {"items": []}
api.collections().create().execute.side_effect = ({"uuid": "zzzzz-4zz18-zzzzzzzzzzzzzz1",
"portable_data_hash": "99999999999999999999999999999991+99"},
@@ -43,6 +44,7 @@ class TestSubmit(unittest.TestCase):
api.jobs().create.assert_called_with(
body={
+ 'owner_uuid': user_uuid,
'runtime_constraints': {
'docker_image': 'arvados/jobs'
},
@@ -58,3 +60,44 @@ class TestSubmit(unittest.TestCase):
'script': 'cwl-runner'
},
find_or_create=True)
+
+ @mock.patch("arvados.commands.keepdocker.list_images_in_arv")
+ @mock.patch("arvados.collection.KeepClient")
+ @mock.patch("arvados.events.subscribe")
+ def test_submit_with_project_uuid(self, events, keep, keepdocker):
+ api = mock.MagicMock()
+ def putstub(p, **kwargs):
+ return "%s+%i" % (hashlib.md5(p).hexdigest(), len(p))
+ keep().put.side_effect = putstub
+ keepdocker.return_value = True
+ api.users().current().execute.return_value = {"uuid": "zzzzz-tpzed-zzzzzzzzzzzzzzz"}
+ api.collections().list().execute.return_value = {"items": []}
+ api.collections().create().execute.side_effect = ({"uuid": "zzzzz-4zz18-zzzzzzzzzzzzzz1",
+ "portable_data_hash": "99999999999999999999999999999991+99"},
+ {"uuid": "zzzzz-4zz18-zzzzzzzzzzzzzz2",
+ "portable_data_hash": "99999999999999999999999999999992+99"})
+ api.jobs().create().execute.return_value = {"uuid": "zzzzz-8i9sb-zzzzzzzzzzzzzzz", "state": "Queued"}
+ project_uuid = 'zzzzz-j7d0g-zzzzzzzzzzzzzzz'
+
+ arvados_cwl.main(["--debug", "--submit", "--project-uuid", project_uuid,
+ "--no-wait", "tests/wf/submit_wf.cwl", "tests/submit_test_job.json"],
+ sys.stdout, sys.stderr, api_client=api)
+
+ api.jobs().create.assert_called_with(
+ body={
+ 'owner_uuid': project_uuid,
+ 'runtime_constraints': {
+ 'docker_image': 'arvados/jobs'
+ },
+ 'script_parameters': {
+ 'x': {
+ 'path': '99999999999999999999999999999992+99/blorp.txt',
+ 'class': 'File'
+ },
+ 'cwl:tool': '99999999999999999999999999999991+99/wf/submit_wf.cwl'
+ },
+ 'repository': 'arvados',
+ 'script_version': 'master',
+ 'script': 'cwl-runner'
+ },
+ find_or_create=True)
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list