mllg / batchtools

Tools for computation on batch systems
https://mllg.github.io/batchtools/
GNU Lesser General Public License v3.0
173 stars 51 forks source link

allow for more than one partition in SLURM #271

Open aaronpeikert opened 3 years ago

aaronpeikert commented 3 years ago

See documentation https://slurm.schedmd.com/sbatch.html:

If the job can use more than one partition, specify their names in a comma separate list and the one offering earliest initiation will be used with no regard given to the partition name ordering (although higher priority partitions will be considered first).

The current behaviour works, however, it is surprising (only the first partition gets used):

resources <- list(partition = c("short", "long"))
# old, string gets repeated, slurm uses only first
sprintf(paste0("#SBATCH --partition='", resources$partition, "'"))
#> [1] "#SBATCH --partition='short'" "#SBATCH --partition='long'"
# new, comma seperated list
sprintf(paste0("#SBATCH --partition='", paste(resources$partition, collapse = ","), "'"))
#> [1] "#SBATCH --partition='short,long'"

Created on 2021-04-09 by the reprex package (v1.0.0)