@@ -469,11 +469,10 @@ def copy_job_order(job, job_order_object):
469
469
# record provenance of an independent commandline tool execution
470
470
self .prospective_prov (job )
471
471
customised_job = copy_job_order (job , job_order_object )
472
- relativised_input_object2 , reference_locations = \
472
+ inputs , reference_locations = \
473
473
research_obj .create_job (
474
474
customised_job , make_fs_access )
475
- entity = self .declare_artefact (relativised_input_object2 )
476
- self .document .used (self .engine_uuid , entity )
475
+ self .used_artefacts (inputs , self .workflow_run_uri )
477
476
name = ""
478
477
if hasattr (job , "name" ):
479
478
name = str (job .name )
@@ -482,11 +481,10 @@ def copy_job_order(job, job_order_object):
482
481
elif hasattr (job , "workflow" ): # record provenance for the workflow execution
483
482
self .prospective_prov (job )
484
483
customised_job = copy_job_order (job , job_order_object )
485
- relativised_input_object2 , reference_locations = \
484
+ inputs , reference_locations = \
486
485
research_obj .create_job (
487
486
customised_job , make_fs_access )
488
- entity = self .declare_artefact (relativised_input_object2 )
489
- self .document .used (self .engine_uuid , entity )
487
+ self .used_artefacts (inputs , self .workflow_run_uri )
490
488
else : # in case of commandline tool execution as part of workflow
491
489
name = ""
492
490
if hasattr (job , "name" ):
@@ -538,7 +536,16 @@ def declare_artefact(self, value):
538
536
return self .document .entity (CWLPROV ["None" ],
539
537
{ provM .PROV_LABEL : "None" })
540
538
541
- if isinstance (value , (str , Text , bytes )):
539
+ elif isinstance (value , (bool , int , float )):
540
+ # Typically used in job documents for flags
541
+
542
+ # FIXME: Make consistent hash URIs for these
543
+ # that somehow include the type
544
+ # (so "1" != 1 != "1.0" != true)
545
+ return self .document .entity (uuid .uuid4 ().urn ,
546
+ { provM .PROV_VALUE : value })
547
+
548
+ elif isinstance (value , (str , Text , bytes )):
542
549
if type (value ) == bytes :
543
550
# Leave as-is (Note: In Python2 this includes strings
544
551
# which will be written with system encoding)
@@ -554,7 +561,7 @@ def declare_artefact(self, value):
554
561
{provM .PROV_TYPE : WFPROV ["Artifact" ],
555
562
provM .PROV_VALUE : str (value )})
556
563
557
- if isinstance (value , dict ):
564
+ elif isinstance (value , dict ):
558
565
# Base case - we found a File we need to update
559
566
if value .get ("class" ) == "File" :
560
567
if 'checksum' in value :
@@ -686,15 +693,18 @@ def declare_artefact(self, value):
686
693
687
694
def used_artefacts (self ,
688
695
job_order , # type: Dict
689
- process_run_id , # type: Optional[ str]
690
- name # type: str
696
+ process_run_id , # type: str
697
+ name = None # type: Optional[ str]
691
698
): # type: (...) -> None
692
699
'''
693
700
adds used() for each data artefact
694
701
'''
702
+ # FIXME: Use workflow name in packed.cwl, "main" is wrong for nested workflows
703
+ base = "main"
704
+ if name :
705
+ base += "/" + name
695
706
for key , value in job_order .items ():
696
- # FIXME: Use workflow name in packed.cwl, "main" is wrong for nested workflows
697
- prov_role = self .wf_ns ["main/%s/%s" % (name , key )]
707
+ prov_role = self .wf_ns ["%s/%s" % (base , key )]
698
708
entity = self .declare_artefact (value )
699
709
self .document .used (
700
710
process_run_id , entity ,
0 commit comments