4040
4141WORKFLOW_BASENAME = "packed.cwl"
4242INPUTS_FILE_BASENAME = "primary-job.json"
43+ MANIFEST_FILE = "manifest-sha1.txt"
4344
4445CWL_TYPE_MAP = {
4546 "string" : "Text" ,
@@ -211,6 +212,7 @@ def __init__(self, root, workflow_name=None, license=None, readme=None):
211212 self .hashes = {}
212213 # map source files to destination files
213214 self .file_map = {}
215+ self .manifest = self ._get_manifest ()
214216
215217 @staticmethod
216218 def _get_step_maps (cwl_defs ):
@@ -225,6 +227,14 @@ def _get_step_maps(cwl_defs):
225227 rval [k ][f ] = {"tool" : get_fragment (s .run ), "pos" : pos_map [f ]}
226228 return rval
227229
230+ def _get_manifest (self ):
231+ manifest = {}
232+ with open (self .root / Path (MANIFEST_FILE )) as f :
233+ for line in f :
234+ hash_ , relpath = line .strip ().split (None , 1 )
235+ manifest [hash_ ] = self .root / relpath
236+ return manifest
237+
228238 def _resolve_plan (self , activity ):
229239 job_qname = activity .plan ()
230240 plan = activity .provenance .entity (job_qname )
@@ -576,7 +586,7 @@ def convert_param(self, prov_param, crate, convert_secondary=True, parent=None):
576586 dest = Path (parent .id if parent else "" ) / hash_
577587 action_p = crate .dereference (dest .as_posix ())
578588 if not action_p :
579- source = self .root / Path ( "data" ) / hash_ [: 2 ] / hash_
589+ source = self .manifest [ hash_ ]
580590 action_p = crate .add_file (source , dest , properties = {
581591 "sha1" : hash_ ,
582592 })
0 commit comments