# Are we under a Slurm Cluster?
slurm_available()
if (FALSE) {
# What is the maximum number of jobs (array size) that the system
# allows?
sconfig <- slurm.conf() # We first retrieve the info.
sconfig["MaxArraySize"]
}
if (FALSE) {
# Submitting a simple job
job <- Slurm_EvalQ(slurmR::WhoAmI(), njobs = 4L, plan = "submit")
# Checking the status of the job (we can simply print)
job
status(job) # or use the state function
sacct(job) # or get more info with the sactt wrapper.
# Suppose one of the jobs is taking too long to complete (say #4)
# we can stop it and resubmit the job as follows:
scancel(job)
# Resubmitting only 4
sbatch(job, array = 4) # A new jobid will be assigned
}
Run the code above in your browser using DataLab