11557: Don't assume log, output and components are always present on a job record.
authorLucas Di Pentima <lucas@curoverse.com>
Mon, 5 Jun 2017 13:43:07 +0000 (10:43 -0300)
committerLucas Di Pentima <lucas@curoverse.com>
Mon, 5 Jun 2017 13:43:07 +0000 (10:43 -0300)
This was causing some tests to fail.

Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas@curoverse.com>

sdk/cwl/arvados_cwl/arvjob.py

index c3eb919a74819300852edc89005f465fe4ef7656..a620a207497b514fda743f6e7384c562369055d7 100644 (file)
@@ -293,7 +293,8 @@ class RunnerJob(Runner):
 
         if self.enable_reuse:
             # When reusing jobs, copy its output/log collection to the desired project
-            reused_collections = [('Output', job['output']), ('Log', job['log'])]
+            reused_collections = [('Output', job.get('output', None)),
+                                  ('Log', job.get('log', None))]
             for col_type, pdh in [(n, p) for n, p in reused_collections if p]:
                 c = arvados.collection.Collection(pdh,
                                                   api_client=self.arvrunner.api,
@@ -307,7 +308,7 @@ class RunnerJob(Runner):
                             col_type.lower(),
                             c.manifest_locator())
             # Give read permission to the desired project on reused jobs
-            for job_name, job_uuid in job['components'].items():
+            for job_name, job_uuid in job.get('components', {}).items():
                 self.arvrunner.api.links().create(body={
                     'link_class': 'can_read',
                     'tail_uuid': self.arvrunner.project_uuid,