killJobs: Kill some jobs on the batch system.

View source: R/killJobs.R

killJobsR Documentation

Kill some jobs on the batch system.

Description

Kill jobs which have already been submitted to the batch system. If a job is killed its internal state is reset as if it had not been submitted at all.

The function informs if (a) the job you want to kill has not been submitted, (b) the job has already terminated, (c) for some reason no batch job id is available. In all 3 cases above, nothing is changed for the state of this job and no call to the internal kill cluster function is generated.

In case of an error when killing, the function tries - after a short sleep - to kill the remaining batch jobs again. If this fails again for some jobs, the function gives up. Only jobs that could be killed are reset in the DB.

Usage

killJobs(reg, ids, progressbar = TRUE)

Arguments

reg

[Registry]
Registry.

ids

[integer]
Ids of jobs to kill. Default is none.

progressbar

[logical(1)]
Set to FALSE to disable the progress bar. To disable all progress bars, see makeProgressBar.

Value

[integer]. Ids of killed jobs.

See Also

Other debug: debugMulticore(), debugSSH(), getErrorMessages(), getJobInfo(), getLogFiles(), grepLogs(), resetJobs(), setJobFunction(), showLog(), testJob()

Examples

## Not run: 
reg = makeRegistry(id = "BatchJobsExample", file.dir = tempfile(), seed = 123)
f = function(x) Sys.sleep(x)
batchMap(reg, f, 1:10 + 5)
submitJobs(reg)
waitForJobs(reg)

# kill all jobs currently _running_
killJobs(reg, findRunning(reg))
# kill all jobs queued or running
killJobs(reg, findNotTerminated(reg))

## End(Not run)

BatchJobs documentation built on March 21, 2022, 5:05 p.m.