@@ -447,28 +447,6 @@ def evaluate(self,
447
447
evaluate the nature of r and
448
448
initialize the activity start
449
449
'''
450
- def copy_job_order (job , job_order_object ):
451
- # type: (Any,Any) -> Any
452
- '''
453
- creates copy of job object for provenance
454
- '''
455
- if not hasattr (job , "tool" ):
456
- # direct command line tool execution
457
- return job_order_object
458
- customised_job = {} # new job object for RO
459
- for each , i in enumerate (job .tool ["inputs" ]):
460
- with SourceLine (job .tool ["inputs" ], each , WorkflowException ,
461
- _logger .isEnabledFor (logging .DEBUG )):
462
- iid = shortname (i ["id" ])
463
- if iid in job_order_object :
464
- customised_job [iid ] = copy .deepcopy (job_order_object [iid ])
465
- # add the input element in dictionary for provenance
466
- elif "default" in i :
467
- customised_job [iid ] = copy .deepcopy (i ["default" ])
468
- # add the default elements in the dictionary for provenance
469
- else :
470
- pass
471
- return customised_job
472
450
473
451
process_run_id = None
474
452
research_obj = runtimeContext .research_obj
@@ -479,8 +457,7 @@ def copy_job_order(job, job_order_object):
479
457
self .prospective_prov (job )
480
458
customised_job = copy_job_order (job , job_order_object )
481
459
self .used_artefacts (customised_job , self .workflow_run_uri )
482
- inputs = research_obj .create_job (
483
- customised_job )
460
+ research_obj .create_job (job , customised_job )
484
461
#self.used_artefacts(inputs, self.workflow_run_uri)
485
462
name = ""
486
463
if hasattr (job , "name" ):
@@ -491,8 +468,8 @@ def copy_job_order(job, job_order_object):
491
468
self .prospective_prov (job )
492
469
customised_job = copy_job_order (job , job_order_object )
493
470
self .used_artefacts (customised_job , self .workflow_run_uri )
494
- inputs = research_obj .create_job (
495
- customised_job )
471
+ # inputs = research_obj.create_job(
472
+ # customised_job)
496
473
#self.used_artefacts(inputs, self.workflow_run_uri)
497
474
else : # in case of commandline tool execution as part of workflow
498
475
name = ""
@@ -1542,28 +1519,30 @@ def _add_to_bagit(self, rel_path, **checksums):
1542
1519
self .add_to_manifest (rel_path , checksums )
1543
1520
1544
1521
def create_job (self ,
1545
- job , # type: Dict
1522
+ wfJob ,
1523
+ builderJob # type: Dict
1546
1524
): # type: (...) -> Dict
1547
1525
#TODO customise the file
1548
1526
'''
1549
1527
This function takes the dictionary input object and generates
1550
1528
a json file containing the relative paths and link to the associated
1551
1529
cwl document
1552
1530
'''
1531
+ copied = copy .deepcopy (builderJob )
1553
1532
relativised_input_objecttemp = {} # type: Dict[Any,Any]
1554
- self .relativise_files (job )
1555
-
1533
+ self .relativise_files (copied )
1556
1534
rel_path = posixpath .join (_posix_path (WORKFLOW ), "primary-job.json" )
1557
- j = json .dumps (job , indent = 4 , ensure_ascii = False )
1535
+ j = json .dumps (copied , indent = 4 , ensure_ascii = False )
1558
1536
with self .write_bag_file (rel_path ) as file_path :
1559
1537
file_path .write (j + u"\n " )
1560
1538
_logger .info (u"[provenance] Generated customised job file: %s" , rel_path )
1561
-
1539
+ print ("copied: " , copied )
1540
+ print ("original" , builderJob )
1562
1541
#Generate dictionary with keys as workflow level input IDs and values as
1563
1542
#1) for files the relativised location containing hash
1564
1543
#2) for other attributes, the actual value.
1565
1544
relativised_input_objecttemp = {}
1566
- for key , value in job .items ():
1545
+ for key , value in copied .items ():
1567
1546
if isinstance (value , dict ):
1568
1547
if value .get ("class" ) in ("File" , "Directory" ):
1569
1548
relativised_input_objecttemp [key ] = value
@@ -1673,3 +1652,26 @@ def checksum_copy(file_path, # type: IO
1673
1652
if copy_to_fp is not None :
1674
1653
copy_to_fp .flush ()
1675
1654
return checksum .hexdigest ().lower ()
1655
+
1656
+ def copy_job_order (job , job_order_object ):
1657
+ # type: (Any,Any) -> Any
1658
+ '''
1659
+ creates copy of job object for provenance
1660
+ '''
1661
+ if not hasattr (job , "tool" ):
1662
+ # direct command line tool execution
1663
+ return job_order_object
1664
+ customised_job = {} # new job object for RO
1665
+ for each , i in enumerate (job .tool ["inputs" ]):
1666
+ with SourceLine (job .tool ["inputs" ], each , WorkflowException ,
1667
+ _logger .isEnabledFor (logging .DEBUG )):
1668
+ iid = shortname (i ["id" ])
1669
+ if iid in job_order_object :
1670
+ customised_job [iid ] = copy .deepcopy (job_order_object [iid ])
1671
+ # add the input element in dictionary for provenance
1672
+ elif "default" in i :
1673
+ customised_job [iid ] = copy .deepcopy (i ["default" ])
1674
+ # add the default elements in the dictionary for provenance
1675
+ else :
1676
+ pass
1677
+ return customised_job
0 commit comments