Skip to content

Commit 10bfc29

Browse files
author
Vasu Jaganath
committed
add (minimum) pass through flags for Toil
1 parent aa19a85 commit 10bfc29

File tree

2 files changed

+59
-1
lines changed

2 files changed

+59
-1
lines changed

src/sophios/cli.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,33 @@
125125
parser.add_argument('--custom_net', type=str, required=False,
126126
help='Passes --custom-net flag to cwltool.')
127127

128+
# Toil pass through flags
129+
parser.add_argument('--toil_batchsystem', type=str, required=False, default='slurm',
130+
help='pass through flag for toil batch system')
131+
parser.add_argument('--toil_defaultMemory', type=str, required=False, default='10GB',
132+
help='pass through flag for toil default memory')
133+
parser.add_argument('--toil_defaulDisk', type=str, required=False, default='10Gi',
134+
help='pass through flag for toil default disk usage')
135+
parser.add_argument('--toil_maxCores', type=int, required=False, default=128,
136+
help='pass through flag for toil max number of cpu core usage')
137+
parser.add_argument('--toil_maxLocalJobs', type=int, required=False, default=128,
138+
help='pass through flag for toil max number of local jobs')
139+
parser.add_argument('--toil_slurmArgs', type=str, required=False,
140+
default='--export=ALL --partition=normal_cpu --error=serror.txt',
141+
help='pass through flag for toil slurm arguments')
142+
parser.add_argument('--toil_defaultCores', type=int, required=False, default=2,
143+
help='pass through flag for toil default number of cores per job')
144+
parser.add_argument('--toil_logLevel', type=str, required=False, default='CRITICAL',
145+
help='pass through flag for toil log level (OFF, CRITICAL, INFO, ERROR, WARN, INFO, DEBUG)')
146+
parser.add_argument('--toil_clusterStats', type=str, required=False, default='clusterStats.json',
147+
help='pass through flag for toil dumping cluster stats')
148+
parser.add_argument('--toil_coordinationDir', type=str, required=False, default=str(Path.cwd()),
149+
help='pass through flag for toil coordinationDir')
150+
parser.add_argument('--toil_workDir', type=str, required=False, default=str(Path.cwd()),
151+
help='pass through flag for toil workDir')
152+
parser.add_argument('--batchLogsDir', type=str, required=False, default=str(Path.cwd() / 'slurmlogs'),
153+
help='pass through flag for toil dumping directory for batch logs')
154+
128155

129156
def get_args(yaml_path: str = '', suppliedargs: list[str] = []) -> argparse.Namespace:
130157
"""This is used to get mock command line arguments, default + suppled args

src/sophios/run_local.py

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,39 @@ def run_local(args: argparse.Namespace, rose_tree: RoseTree, cachedir: Optional[
250250
date_time = now.strftime("%Y%m%d%H%M%S")
251251
cmd += ['--outdir', f'outdir_toil_{yaml_stem}_{date_time}',
252252
'--jobStore', f'file:./jobStore_{yaml_stem}', # NOTE: This is the equivalent of --cachedir
253+
'--batchSystem', args.toil_batchsystem,
254+
# The default amount of memory to request for a job (in bytes), by default is 2^31 = 2 gigabytes
255+
# Not applied to the CWL jobs. The CWL CLTs should define RamMin in the ResourceRequirement section
256+
'--defaultMemory', args.toil_defaultmemory,
257+
'--defaultDisk', args.toil_defaultDisk,
258+
# Not giving users these choice is better?
259+
'--statePollingWait', '0', # See https://github.com/DataBiosphere/toil/pull/4471
260+
'--retryCount', '0', # There appear to be random errors due to the panassas network file system.
261+
# Number of times to retry a failing job before giving
262+
# up and labeling job failed. default=0
263+
'--maxCores', str(args.toil_maxCores),
264+
'--maxLocalJobs', str(args.toil_maxLocalJobs),
265+
'--disableAutoDeployment', 'True',
266+
# Should auto-deployment of the user script be deactivated?
267+
# If True, the user script/package should be present
268+
# at the same location on all workers. Default = False.
269+
'--stats',
270+
# Records statistics about the toil workflow to be used by 'toil stats'.
271+
'--clusterStats', args.toil_clusterStats,
272+
'--workDir', args.toil_workDir, # "This directory needs to exist on all machines running jobs."
273+
# i.e. /run/user/$UID/coorddir This is a local /tmpfs (in-memory) NOT NFS
274+
# "Absolute path to directory where Toil will keep state and lock files."
275+
'--coordinationDir', args.toil_coordinationDir,
276+
'--disableCaching', # THIS NEEDS MORE DATA
277+
'--disableProgress', # disable the progress bar in the terminal, saves UI cycle
253278
# TODO: Check --clean, --cleanWorkDir, --restart
254-
'--clean', 'always', # This effectively disables caching, but is reproducible
279+
# '--clean', 'ne', # This effectively disables caching, but is reproducible
280+
'--cleanWorkDir', 'never',
281+
'--clean', 'never',
282+
'--slurmArgs', args.toil_slurmArgs,
283+
'--defaultCores', str(args.toil_defaultCores),
284+
'--logLevel', args.toil_logLevel, # for debugging
285+
'--batchLogsDir', args.toil_batchLogsDir,
255286
f'autogenerated/{yaml_stem}.cwl', f'autogenerated/{yaml_stem}_inputs.yml']
256287
cmdline = ' '.join(cmd)
257288

0 commit comments

Comments
 (0)