From 334d255dddab1c736d28328f3dab4ee5dd8635b3 Mon Sep 17 00:00:00 2001 From: Corwin Kerr Date: Thu, 14 Mar 2024 17:23:51 -0400 Subject: [PATCH 1/2] Add jinja2 block around memory options This is to enable overriding --mem with --mem-per-gpu or other cluster-specific options. --- flow/templates/slurm.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/flow/templates/slurm.sh b/flow/templates/slurm.sh index 88f4c2747..4e5c64ed1 100644 --- a/flow/templates/slurm.sh +++ b/flow/templates/slurm.sh @@ -4,9 +4,11 @@ #!/bin/bash #SBATCH --job-name="{{ id }}" {% set memory_requested = operations | calc_memory(parallel) %} +{% block memory %} {% if memory_requested %} #SBATCH --mem={{ memory_requested|format_memory }} {% endif %} +{% endblock memory %} {% if partition %} #SBATCH --partition={{ partition }} {% endif %} From 7c7a3210ff694d0b4fc7db0691416f91ac7af552 Mon Sep 17 00:00:00 2001 From: Corwin Kerr Date: Fri, 15 Mar 2024 13:58:30 -0400 Subject: [PATCH 2/2] Add the scoped option See https://jinja.palletsprojects.com/en/3.0.x/templates/#block-nesting-and-scope --- flow/templates/slurm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flow/templates/slurm.sh b/flow/templates/slurm.sh index 4e5c64ed1..596b3d6c0 100644 --- a/flow/templates/slurm.sh +++ b/flow/templates/slurm.sh @@ -4,7 +4,7 @@ #!/bin/bash #SBATCH --job-name="{{ id }}" {% set memory_requested = operations | calc_memory(parallel) %} -{% block memory %} +{% block memory scoped %} {% if memory_requested %} #SBATCH --mem={{ memory_requested|format_memory }} {% endif %}