Most 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_slurmR

Format

An object of class opts_slurmR of length 17.

Details

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 () Activates the debugging mode. When active, jobs will be submitted using sh and not sbatch. Also, only a single chunk of the data will be processed.

  • debug_off : function () Deactivates the debugging mode.

  • get_debug : function () Returns TRUE of debug mode is on

Verbose mode

  • verbose_on : function () Deactivates the verbose mode. When ON, sbatch prints the Rscript and batch files on screen so that the user knows what will be submitted to Slurm.

  • verbose_off : function () Deactivates the verbose mode.

  • get_verbose : function () Returns TRUE if verbose mode is on.

Slurm options

  • set_tmp_path : function (path, recursive = TRUE) Sets the tempfile path for I/O

  • get_tmp_path : function () Retrieves tempfile path for I/O

  • set_job_name : function (path, check = TRUE, overwrite = TRUE) Changes the job-name. When changing the name of the job the function will check whether the folder chdir/job-name is empty or not. If empty/not created it will create it, otherwise it will delete its contents (if `overwrite = TRUE``, else it will return with an Error). .

  • get_job_name : function (check = TRUE) Returns the current value of `job-name`.

  • set_preamble : function (...) Sets "preamble" to the RScript call. For example, it could be used for loading modules, setting env variables, etc., needed during the R session. Options are passed as characters.

  • get_preamble : function () Returns the preamble, e.g., module loads, environment variable definitions, etc., that will be included in sbatch submissions.

Other options

  • get_cmd : function () If debug mode is active, then it returns `sh`, otherwise `sbatch`

For general set/retrieve options

  • set_opts : function (...) A generic function to set options.

  • get_opts_job : function (...) A generic function to retrieve options for the job (Slurm).

  • get_opts_r : function (...) A generic function to retrieve options in R.

Nuke

  • While reloading the package should reset all the options, if needed, the user can also use the function opts_slurmR$reset().

Examples


# 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
}