Skip to content

Commit

Permalink
snakemake_mqsub: Handle when mem_mb is missing in snakemake v8.
Browse files Browse the repository at this point in the history
  • Loading branch information
wwood committed Mar 13, 2024
1 parent 569c9d8 commit 3070167
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions bin/snakemake_mqsub
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,12 @@ if __name__ == '__main__':
job_properties = read_job_properties(jobscript)

threads = job_properties['threads']
mem_mb = job_properties['resources']['mem_mb']
mem_gb = int(mem_mb / 1000)
if 'mem_mb' in job_properties['resources']:
mem_mb = job_properties['resources']['mem_mb']
mem_gb = int(mem_mb / 1000)
mem_argument = "-m {}".format(mem_gb)
else:
mem_argument = ''

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

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(
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(
job_name=job_name, extra_mqsub_args=extra_mqsub_args,
threads=threads, script=jobscript, mem=mem_gb, hours=runtime_hours, queue=queue,
threads=threads, script=jobscript, mem=mem_argument, hours=runtime_hours, queue=queue,
segregated_log_files_arg=segregated_log_files_arg)

if args.dry_run:
Expand Down

0 comments on commit 3070167

Please sign in to comment.