I'd like to suggest adding a bit of sanity checks to the template files. This will help lower the bar for new comers who are not aware of the various levels of R-to-scheduler orchestration involved.
if resources does not have ncpus set, then resources$ncpus is NULL, and then <%= NULL %> produces an empty string ``. That is, in the rendered job script, we get:
#SBATCH --cpus-per-task=
This in turn will produce a runtime error when Slurm tries to process the job script, e.g.
Error: Fatal error occurred: 101. Command 'sbatch' produced exit code 1. Output: 'sbatch: error: Invalid numeric value "" for cpus-per-task.'
A few suggestions
Avoid outputting the SBATCH directive if resources$ncpus is missing:
I'd like to suggest adding a bit of sanity checks to the template files. This will help lower the bar for new comers who are not aware of the various levels of R-to-scheduler orchestration involved.
Issue
In 'inst/templates/slurm-simple.tmpl' we have:
https://github.com/mllg/batchtools/blob/1188e2a71028d386119834a22f3f03ba51ac7b85/inst/templates/slurm-simple.tmpl#L26-L34
Take for instance the line:
if
resources
does not havencpus
set, thenresources$ncpus
isNULL
, and then<%= NULL %>
produces an empty string ``. That is, in the rendered job script, we get:This in turn will produce a runtime error when Slurm tries to process the job script, e.g.
A few suggestions
Avoid outputting the SBATCH directive if
resources$ncpus
is missing:or, simply,
Alternatively, make
ncpus
a mandatory field. At the top of the template file, do something like:Related
The background for this is issue can be found in https://github.com/HenrikBengtsson/future.batchtools/issues/41
cc/ @wlandau-lilly (similar for drake's example templates)