sbatch and slurmR internalsMost of the functions in the slurmR package use tmp_path and job-name
options to write and submit jobs to Slurm. These options have global
defaults that are set and retrieved using opts_slurmR. These options
also include SBATCH options and things to do before calling RScript,
e.g., loading modules on an HPC cluster.
opts_slurmRAn object of class opts_slurmR of length 17.
Whatever the path specified on tmp_path, all nodes should have access to it.
Moreover, it is recommended to use a path located in a high-performing drive.
See for example disk staging.
The tmp_path directory is only created at the time that one of the functions
needs to I/O files. Job creation calls like Slurm_EvalQ and Slurm_lapply
do such.
The "preamble" options can be specified if, for example, the current cluster
needs to load R, a compiler, or other programs via a module command.
Current supported options are:
Debugging mode
debug_on : function () attr(slurmR::opts_slurmR$debug_on, "desc")
debug_off : function () attr(slurmR::opts_slurmR$debug_off, "desc")
get_debug : function () attr(slurmR::opts_slurmR$get_debug, "desc")
Verbose mode
verbose_on : function () attr(slurmR::opts_slurmR$verbose_on, "desc")
verbose_off : function () attr(slurmR::opts_slurmR$verbose_off, "desc")
get_verbose : function () attr(slurmR::opts_slurmR$get_verbose, "desc")
Slurm options
set_tmp_path : function (path, recursive = TRUE) attr(slurmR::opts_slurmR$set_tmp_path, "desc")
get_tmp_path : function () attr(slurmR::opts_slurmR$get_tmp_path, "desc")
set_job_name : function (path, check = TRUE, overwrite = TRUE) attr(slurmR::opts_slurmR$set_job_name, "desc").
get_job_name : function (check = TRUE) attr(slurmR::opts_slurmR$get_job_name, "desc")
set_preamble : function (...) attr(slurmR::opts_slurmR$set_preamble, "desc")
get_preamble : function () attr(slurmR::opts_slurmR$get_preamble, "desc")
Other options
get_cmd : function () attr(slurmR::opts_slurmR$get_cmd, "desc")
For general set/retrieve options
set_opts : function (...) attr(slurmR::opts_slurmR$set_opts, "desc")
get_opts_job : function (...) attr(slurmR::opts_slurmR$get_opts_job, "desc")
get_opts_r : function (...) attr(slurmR::opts_slurmR$get_opts_r, "desc")
Nuke
While reloading the package should reset all the options, if needed, the user
can also use the function opts_slurmR$reset().
# Common setup
if (FALSE) {
opts_slurmR$set_tmp_path("/staging/pdt/vegayon")
opts_slurmR$set_job_name("simulations-1")
opts_slurm$set_opts(partition="thomas", account="lc_pdt")
opts_slurm$set_preamble("module load gcc")# if needed
}
Run the code above in your browser using DataLab