[ARVADOS] updated: 405d6345dcbe1494e2a9202bcb5cdf519e7d3e0a

Git user git at public.curoverse.com
Thu Jun 15 12:19:12 EDT 2017


Summary of changes:
 sdk/cwl/arvados_cwl/arvjob.py |  4 ++--
 sdk/cwl/tests/test_job.py     | 20 +++++++++++++++++++-
 2 files changed, 21 insertions(+), 3 deletions(-)

       via  405d6345dcbe1494e2a9202bcb5cdf519e7d3e0a (commit)
      from  e3a2f5a80c1e4bd645e7e8bff27ef94f89ceae3e (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 405d6345dcbe1494e2a9202bcb5cdf519e7d3e0a
Author: Lucas Di Pentima <lucas at curoverse.com>
Date:   Thu Jun 15 13:17:50 2017 -0300

    11557: Fixed can_read link creation, updated test to check this behavior.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at curoverse.com>

diff --git a/sdk/cwl/arvados_cwl/arvjob.py b/sdk/cwl/arvados_cwl/arvjob.py
index 59ae69c..346d3e1 100644
--- a/sdk/cwl/arvados_cwl/arvjob.py
+++ b/sdk/cwl/arvados_cwl/arvjob.py
@@ -146,11 +146,11 @@ class ArvadosJob(object):
             if response["state"] == "Complete":
                 logger.info("%s reused job %s", self.arvrunner.label(self), response["uuid"])
                 # Give read permission to the desired project on reused jobs
-                for job_name, job_uuid in response.get('components', {}).items():
+                if response["owner_uuid"] != self.arvrunner.project_uuid:
                     self.arvrunner.api.links().create(body={
                         'link_class': 'can_read',
                         'tail_uuid': self.arvrunner.project_uuid,
-                        'head_uuid': job_uuid,
+                        'head_uuid': response["uuid"],
                         }).execute(num_retries=self.arvrunner.num_retries)
 
                 with Perf(metrics, "done %s" % self.name):
diff --git a/sdk/cwl/tests/test_job.py b/sdk/cwl/tests/test_job.py
index 14e006e..5cd7f2a 100644
--- a/sdk/cwl/tests/test_job.py
+++ b/sdk/cwl/tests/test_job.py
@@ -33,7 +33,15 @@ class TestJob(unittest.TestCase):
             document_loader, avsc_names, schema_metadata, metaschema_loader = cwltool.process.get_schema("v1.0")
 
             list_images_in_arv.return_value = [["zzzzz-4zz18-zzzzzzzzzzzzzzz"]]
-            runner.api.collections().get().execute.return_vaulue = {"portable_data_hash": "99999999999999999999999999999993+99"}
+            runner.api.collections().get().execute.return_value = {"portable_data_hash": "99999999999999999999999999999993+99"}
+            # Simulate reused job from another project so that we can check is a can_read
+            # link is added.
+            runner.api.jobs().create().execute.return_value = {
+                'state': 'Complete' if enable_reuse else 'Queued',
+                'owner_uuid': 'zzzzz-tpzed-yyyyyyyyyyyyyyy' if enable_reuse else 'zzzzz-8i9sb-zzzzzzzzzzzzzzz',
+                'uuid': 'zzzzz-819sb-yyyyyyyyyyyyyyy',
+                'output': None,
+            }
 
             tool = cmap({
                 "inputs": [],
@@ -75,6 +83,16 @@ class TestJob(unittest.TestCase):
                              ['script_version', 'in git', 'a3f2cb186e437bfce0031b024b2157b73ed2717d'],
                              ['docker_image_locator', 'in docker', 'arvados/jobs']]
                 )
+                if enable_reuse:
+                    runner.api.links().create.assert_called_with(
+                        body=JsonDiffMatcher({
+                            'link_class': 'can_read',
+                            "tail_uuid": "zzzzz-8i9sb-zzzzzzzzzzzzzzz",
+                            "head_uuid": "zzzzz-819sb-yyyyyyyyyyyyyyy",
+                        })
+                    )
+                else:
+                    assert not runner.api.links().create.called
 
     # The test passes some fields in builder.resources
     # For the remaining fields, the defaults will apply: {'cores': 1, 'ram': 1024, 'outdirSize': 1024, 'tmpdirSize': 1024}

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list