Skip to content

Commit

Permalink
add parameter tmpdir-prefix for cwltool
Browse files Browse the repository at this point in the history
  • Loading branch information
leiyan committed Jan 6, 2023
1 parent 5ac444a commit 78f8786
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions SJARACNe/sjaracne.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ def main():
help='Number of bootstrap networks to generate.')
parent_parser.add_argument('-o', '--output-dir', metavar='DIR', required=True,
help='Path to final output directory.')
parent_parser.add_argument('-tmp', '--tmpdir-prefix', dest='tmpdir_prefix',metavar='DIR', required=True,
help='Specify tmp path,default is /tmp.')

subparsers = parser.add_subparsers(title='Subcommands', help='platforms', dest='subcommand')
subparsers.required = True
Expand Down Expand Up @@ -61,9 +63,12 @@ def main():
config_dir = args.config_dir
else:
config_dir = default_config_path

if not os.path.isdir(args.tmpdir_prefix):
os.makedirs(args.tmpdir_prefix)

if not os.path.isdir(args.output_dir):
os.mkdir(args.output_dir)
os.makedirs(args.output_dir)
output_dir_name = os.path.basename(args.output_dir)
# Create input yml file in a temp directory
with open(pathlib.PurePath(args.output_dir).joinpath('sjaracne_workflow.yml'), 'w') as fp_yml:
Expand All @@ -85,11 +90,9 @@ def main():

if args.subcommand == 'local':
if args.serial:
cmd = 'cwltool --outdir {} {}/sjaracne_workflow.cwl {}'.format(args.output_dir, cwl_path,
fp_yml.name)
cmd = 'cwltool --tmpdir-prefix {} --outdir {} {}/sjaracne_workflow.cwl {}'.format(args.tmpdir_prefix, args.output_dir, cwl_path,fp_yml.name)
else:
cmd = 'cwltool --parallel --outdir {} {}/sjaracne_workflow.cwl {}'.format(args.output_dir,
cwl_path, fp_yml.name)
cmd = 'cwltool --tmpdir-prefix {} --parallel --outdir {} {}/sjaracne_workflow.cwl {}'.format(args.tmpdir_prefix, args.output_dir,cwl_path, fp_yml.name)
elif args.subcommand == 'lsf':
cmd = 'cwlexec -pe PATH -c {} --outdir {} {}/sjaracne_workflow.cwl {}'.format(
args.config_json, args.output_dir, cwl_path, fp_yml.name)
Expand Down

0 comments on commit 78f8786

Please sign in to comment.