rQsub2 | R Documentation |
Submit R jobs in parallel (array).
rQsub2(
path = getwd(),
rFile = "testQsub.R",
jobName = "job",
threaded = 1,
memoryG = 10,
rTimeHour = 2,
logFile = "logfilename.log",
email = NULL,
when2Email = "END,FAIL,STAGE_OUT,TIME_LIMIT",
computeNode = NULL,
moreQsubParams = "",
preCMD = "module load R/3.3.0 && Rscript ",
param1 = 1:10,
...
)
path |
file path. |
rFile |
the R script to run. |
jobName |
the job name(s). |
threaded |
integer or integer vector to specify the number of threads of each job. |
memoryG |
numeric or numeric vector to specify the memory (in Gb) of each job. |
rTimeHour |
numeric or numeric vector. Maximum running time (in hour) of each job. |
logFile |
the log file(s) for errors and warnings. |
email |
email to receive report from HPC. The default is NULL. |
when2Email |
when will the server send a email. Valid values are NONE, BEGIN, END, FAIL, REQUEUE, ALL (equivalent to BEGIN, END, FAIL, REQUEUE, and STAGE_OUT), STAGE_OUT (burst buffer stage out and teardown completed), TIME_LIMIT, TIME_LIMIT_90 (reached 90 percent of time limit), TIME_LIMIT_80 (reached 80 percent of time limit), TIME_LIMIT_50 (reached 50 percent of time limit) and ARRAY_TASKS (send emails for each array task). Multiple values may be specified in a comma separated list. The default is "END,FAIL,STAGE_OUT,TIME_LIMIT". For compatibility, when2Email="aes" is allowed, meaning when2Email="END,FAIL,STAGE_OUT,TIME_LIMIT". |
computeNode |
which computing CPU node will be used?
Support regular expression. The default is NULL, meaning the node is not
specified. For compatibility, computeNode = |
moreQsubParams |
more sbatch parameters. |
preCMD |
the command to run R script, the default is 'echo "module load R/3.3.0 && Rscript '. |
param1 |
the first parameter passed to R script. |
... |
other parameter passed to R script. |
A list of output of running rFile.
## Not run:
# This function can only run on HPC with slurm.
## Section 1, the format of R script file (for example myfile.R) to submit:
args = commandArgs(TRUE)
if (FALSE){
# Input the code to use rQsub, see section
# And run the code manually in this if`{}` statement , for example:
rQsub2(path = getwd(), rFile = "myfile.R", param1 = 1:5)
}
arg1 = args[1]
# Then input R code to use the arg1 variable. for example:
cat("test code result:", arg1, "\n")
## Section 2, the code to use rQsub
# One parameter in R script
path = "/my/file/path"
rQsub2(path = "/my/file/path",
rFile = paste0(path, "/testQsub.R"),
jobName = "job", threaded = 1,
memoryG = 10, rTimeHour = 2,
logFile = paste0(path, "/logfilename.log"),
preCMD = 'module load R/3.3.0 && Rscript ',
param1 = 1:10)
# Multiple parameters in R script and using 2 threads
rQsub2(path = "/my/file/path",
rFile = paste0(path, "/testQsub.R"),
jobName = "job", threaded = 2,
param1 = 1:10, param2 = 2:11, param3 = 3:12)
# Specify job names, threads, memories and running time.
rQsub2(path = "/my/file/path",
rFile = paste0(path, "/testQsub.R"),
jobName = paste0("job_", formatN(1:10, 2)),
logFile = paste0(path, "/logfilename_", formatN(1:10, 2), ".log"),
threaded = rep(c(1, 2), each = 5),
memoryG = rep(c(10, 20), each = 5),
rTimeHour = rep(c(24, 48), each = 5),
param1 = 1:10)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.