Wait for a Slurm job to be completed
wait_slurm(x, ...)
# S3 method for slurm_job
wait_slurm(x, ...)
# S3 method for integer
wait_slurm(x, timeout = -1, freq = 0.1, force = TRUE, ...)
Either a job id number, or an object of class slurm_job.
Further arguments passed to the method
Integer. Maximum wait time in seconds. If timeout < 0
then the command will only return when the job finishes.
Frequency in seconds to query for the state of the job.
Logical scalar. When TRUE
, if the job is not found
after checking for its status, the function will continue to wait
still.
Invisible NULL
.
# Waiting is only available if there are Slurm clusters
if (slurm_available()) {
job <- Slurm_EvalQ(Sys.sleep(1000), plan = "submit", njobs = 2)
wait_slurm(job, timeout = 1) # This will return a warning
scancel(job)
Slurm_clean(job)
}