@@ -304,7 +304,7 @@ def run_local(args: argparse.Namespace, rose_tree: RoseTree, cachedir: Optional[
304304 return retval
305305
306306
307- def copy_output_files (yaml_stem : str ) -> None :
307+ def copy_output_files (yaml_stem : str , basepath : str = '' ) -> None :
308308 """Copies output files from the cachedir to outdir/
309309
310310 Args:
@@ -338,7 +338,11 @@ def copy_output_files(yaml_stem: str) -> None:
338338 # except do it BEFORE the extension.
339339 # This could still cause problems with slicing, i.e. if you scatter across
340340 # indices 11-20 first, then 1-10 second, the output file indices will get switched.
341- dest = 'outdir/' + parentdirs + '/' + basename
341+ dest = ''
342+ if basepath :
343+ dest = basepath + '/' + 'outdir/' + parentdirs + '/' + basename
344+ else :
345+ dest = 'outdir/' + parentdirs + '/' + basename
342346 if dest in dests :
343347 idx = 2
344348 while Path (dest ).exists ():
@@ -364,7 +368,7 @@ def build_cmd(workflow_name: str, basepath: str, cwl_runner: str, container_cmd:
364368 """
365369 quiet = ['--quiet' ]
366370 skip_schemas = ['--skip-schemas' ]
367- provenance = ['--provenance' , f'provenance/{ workflow_name } ' ]
371+ provenance = ['--provenance' , f'{ basepath } / provenance/{ workflow_name } ' ]
368372 container_cmd_ : List [str ] = []
369373 if container_cmd == 'docker' :
370374 container_cmd_ = []
@@ -390,8 +394,8 @@ def build_cmd(workflow_name: str, basepath: str, cwl_runner: str, container_cmd:
390394 now = datetime .now ()
391395 date_time = now .strftime ("%Y%m%d%H%M%S" )
392396 cmd = [script ] + container_pull + provenance + container_cmd_ + path_check
393- cmd += ['--outdir' , f'outdir_toil_ { workflow_name } _ { date_time } ' ,
394- '--jobStore' , f'file:. /jobStore_{ workflow_name } ' , # NOTE: This is the equivalent of --cachedir
397+ cmd += ['--outdir' , f'{ basepath } /outdir_toil_ { date_time } ' ,
398+ '--jobStore' , f'file:{ basepath } /jobStore_{ workflow_name } ' , # NOTE: This is the equivalent of --cachedir
395399 '--clean' , 'always' , # This effectively disables caching, but is reproducible
396400 '--disableProgress' , # disable the progress bar in the terminal, saves UI cycle
397401 '--workDir' , '/data1' ,
@@ -451,7 +455,7 @@ def run_cwl_workflow(workflow_name: str, basepath: str, cwl_runner: str, contain
451455 print (e ) # we are always running this on CI
452456 # only copy output files if using cwltool
453457 if cwl_runner == 'cwltool' :
454- copy_output_files (workflow_name )
458+ copy_output_files (workflow_name , basepath = basepath )
455459 return retval
456460
457461
@@ -468,11 +472,11 @@ async def run_cwl_serialized_async(workflow: Json, basepath: str,
468472 env_commands (List[str]): environment variables and commands needed to be run before running the workflow
469473 """
470474 workflow_name = workflow ['name' ]
475+ basepath = basepath .rstrip ("/" ) if basepath != "/" else basepath
471476 output_dirs = pc .find_output_dirs (workflow )
472477 pc .create_output_dirs (output_dirs , basepath )
473478 compiled_cwl = workflow_name + '.cwl'
474479 inputs_yml = workflow_name + '_inputs.yml'
475- basepath = basepath .rstrip ("/" ) if basepath != "/" else basepath
476480 # write _input.yml file
477481 with open (Path (basepath ) / inputs_yml , 'w' , encoding = 'utf-8' ) as f :
478482 yaml .dump (workflow ['yaml_inputs' ], f )
0 commit comments