I help maintain an R package that auto-generates shell scripts for using Slurm to run Rscript
on a remote server. There is a template for a submit.sh
script that is filled in with arguments supplied by the user in an R function. However some systems are configured with environment modules so that the shell script needs to have the line module load R
before Rscript
is called.
Is there some logic I can execute from within R to detect whether module load R
is necessary so that the line module load R
is included in the shell script, conditional on whether or not it's necessary?
Link to the source code of our R package: rslurm
Template for submit.sh
: submit.sh.txt