diff --git a/tests/test_sections.py b/tests/test_sections.py index 4bbe8180..0f75b8fb 100644 --- a/tests/test_sections.py +++ b/tests/test_sections.py @@ -84,6 +84,7 @@ def test_sections(self): "parallel": "", "partition": "SHORT", "plugins": [], + "reservation": "", "qos": "regular", "templateDir": "zppy/templates", "vars": "FSNTOA,FLUT,FSNT,FLNT,FSNS,FLNS,SHFLX,QFLX,TAUX,TAUY,PRECC,PRECL,PRECSC,PRECSL,TS,TREFHT,CLDTOT,CLDHGH,CLDMED,CLDLOW,U", @@ -141,6 +142,7 @@ def test_sections(self): "partition": "SHORT", "plugins": [], "qos": "regular", + "reservation": "", "subsection": None, "templateDir": "zppy/templates", "tpd": 1, @@ -194,6 +196,7 @@ def test_sections(self): "partition": "SHORT", "plugins": [], "qos": "regular", + "reservation": "", "subsection": None, "templateDir": "zppy/templates", "vars": "", @@ -245,6 +248,7 @@ def test_subsections(self): "partition": "SHORT", "plugins": [], "qos": "regular", + "reservation": "", "templateDir": "zppy/templates", "vars": "FSNTOA,FLUT,FSNT,FLNT,FSNS,FLNS,SHFLX,QFLX,TAUX,TAUY,PRECC,PRECL,PRECSC,PRECSL,TS,TREFHT,CLDTOT,CLDHGH,CLDMED,CLDLOW,U", "walltime": "02:00:00", @@ -321,6 +325,7 @@ def test_subsections(self): "partition": "SHORT", "plugins": [], "qos": "regular", + "reservation": "", "subsection": "ts_grid1", "templateDir": "zppy/templates", "tpd": 1, @@ -360,6 +365,7 @@ def test_subsections(self): "partition": "SHORT", "plugins": [], "qos": "regular", + "reservation": "", "subsection": "ts_grid2", "templateDir": "zppy/templates", "tpd": 1, @@ -429,6 +435,7 @@ def test_subsections(self): "partition": "SHORT", "plugins": [], "qos": "regular", + "reservation": "", "subsection": "climo_grid1", "templateDir": "zppy/templates", "vars": "", @@ -462,6 +469,7 @@ def test_subsections(self): "parallel": "mpi", "partition": "LONG", "plugins": [], + "reservation": "", "qos": "regular", "subsection": "climo_grid2", "templateDir": "zppy/templates", diff --git a/zppy/bundle.py b/zppy/bundle.py index 724f6592..5fdde06c 100644 --- a/zppy/bundle.py +++ b/zppy/bundle.py @@ -21,6 +21,7 @@ def __init__(self, c): self.script_dir: str = c["scriptDir"] self.nodes: int = c["nodes"] self.partition: str = c["partition"] + self.reservation: str = c["reservation"] self.qos: str = c["qos"] self.walltime: str = c["walltime"] @@ -55,6 +56,7 @@ def render(self, config): c["prefix"] = self.bundle_name c["nodes"] = self.nodes c["partition"] = self.partition + c["reservation"] = self.reservation c["qos"] = self.qos c["walltime"] = self.walltime c["tasks"] = [os.path.split(t)[-1] for t in self.tasks] diff --git a/zppy/templates/default.ini b/zppy/templates/default.ini index 54726823..13945c1e 100644 --- a/zppy/templates/default.ini +++ b/zppy/templates/default.ini @@ -52,6 +52,8 @@ partition = string(default="") plugins = force_list(default=list()) # Quality of service qos = string(default="regular") +# Reservation -- if you have access to a node reservation, specify it with this parameter. +reservation = string(default="") # scriptDir -- NOTE: this parameter is created internally # templateDir -- NOTE: this parameter is created internally # The variables to process diff --git a/zppy/templates/slurm_header.sh b/zppy/templates/slurm_header.sh index 0fb395fe..7c934139 100644 --- a/zppy/templates/slurm_header.sh +++ b/zppy/templates/slurm_header.sh @@ -7,6 +7,9 @@ #SBATCH --output={{ scriptDir }}/{{ prefix }}.o%j #SBATCH --exclusive #SBATCH --time={{ walltime }} +{% if reservation %} +#SBATCH --reservation={{ reservation }} +{% endif %} {% if machine in ['anvil', 'chrysalis'] %} #SBATCH --partition={{ partition }}