Skip to content

Commit 3070167

Browse files
committed
snakemake_mqsub: Handle when mem_mb is missing in snakemake v8.
1 parent 569c9d8 commit 3070167

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

bin/snakemake_mqsub

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,12 @@ if __name__ == '__main__':
7979
job_properties = read_job_properties(jobscript)
8080

8181
threads = job_properties['threads']
82-
mem_mb = job_properties['resources']['mem_mb']
83-
mem_gb = int(mem_mb / 1000)
82+
if 'mem_mb' in job_properties['resources']:
83+
mem_mb = job_properties['resources']['mem_mb']
84+
mem_gb = int(mem_mb / 1000)
85+
mem_argument = "-m {}".format(mem_gb)
86+
else:
87+
mem_argument = ''
8488

8589
if 'runtime' in job_properties['resources']:
8690
runtime_mins = job_properties['resources']['runtime'] # Fails with snakemake == 7.16.0, but works with 7.30.1
@@ -109,9 +113,9 @@ if __name__ == '__main__':
109113
# But currently mqsub ignores this anyway, so definiting --name has no effect.
110114
job_name = os.path.basename(jobscript).replace('snakemake','')
111115

112-
cmd = "mqsub --no-email --quiet --bg --name {job_name} -t {threads} -m {mem} {hours} --script {script} {queue} {segregated_log_files_arg} {extra_mqsub_args} 2>&1".format(
116+
cmd = "mqsub --no-email --quiet --bg --name {job_name} -t {threads} {mem} {hours} --script {script} {queue} {segregated_log_files_arg} {extra_mqsub_args} 2>&1".format(
113117
job_name=job_name, extra_mqsub_args=extra_mqsub_args,
114-
threads=threads, script=jobscript, mem=mem_gb, hours=runtime_hours, queue=queue,
118+
threads=threads, script=jobscript, mem=mem_argument, hours=runtime_hours, queue=queue,
115119
segregated_log_files_arg=segregated_log_files_arg)
116120

117121
if args.dry_run:

0 commit comments

Comments
 (0)