Skip to content

Commit a65af4c

Browse files
committed
collect secondaries
1 parent 092dab0 commit a65af4c

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

cwltool/provenance.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -601,8 +601,10 @@ def declare_file(self, value):
601601
# then prov:Quotation is not appropriate.
602602
self.document.derivation(sec_entity, file_entity,
603603
other_attributes={PROV["type"]: CWLPROV["SecondaryFile"]})
604-
# TODO: Add to self.secondaries so it can later
604+
# Add to self.secondaries so it can later
605605
# be augmented into primary-job.json
606+
secondaries = self.secondaries.setdefault(checksum, set())
607+
secondaries.add(self.research_object.relativise_files(sec))
606608

607609
return file_entity, entity, checksum
608610

@@ -1549,7 +1551,7 @@ def create_job(self,
15491551
cwl document
15501552
'''
15511553
relativised_input_objecttemp = {} # type: Dict[Any,Any]
1552-
self._relativise_files(job)
1554+
self.relativise_files(job)
15531555

15541556
rel_path = posixpath.join(_posix_path(WORKFLOW), "primary-job.json")
15551557
j = json.dumps(job, indent=4, ensure_ascii=False)
@@ -1571,7 +1573,7 @@ def create_job(self,
15711573
{k: v for k, v in relativised_input_objecttemp.items() if v})
15721574
return relativised_input_object
15731575

1574-
def _relativise_files(self, structure):
1576+
def relativise_files(self, structure):
15751577
# type: (Any, Dict) -> None
15761578
'''
15771579
save any file objects into Research Object and update the local paths
@@ -1607,7 +1609,7 @@ def _relativise_files(self, structure):
16071609
del structure["location"]
16081610

16091611
for val in structure.values():
1610-
self._relativise_files(val)
1612+
self.relativise_files(val)
16111613
return
16121614

16131615
if isinstance(structure, (str, Text)):
@@ -1616,7 +1618,7 @@ def _relativise_files(self, structure):
16161618
try:
16171619
for obj in iter(structure):
16181620
# Recurse and rewrite any nested File objects
1619-
self._relativise_files(obj)
1621+
self.relativise_files(obj)
16201622
except TypeError:
16211623
pass
16221624

0 commit comments

Comments
 (0)