Skip to content

Commit b0dcc18

Browse files
committed
improved control over sleep duration; nodename in cfSlurm
1 parent c07491a commit b0dcc18

29 files changed

+141
-67
lines changed

.gitignore

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
.DS_Store
2-
inst/doc
3-
src/*.so
4-
src/*.o
5-
vignettes/*.html
6-
vignettes/*.pdf
2+
/inst/doc
3+
/src/*.so
4+
/src/*.o
5+
/vignettes/*.html
6+
/vignettes/*.pdf
7+
/.Rproj.user
8+
/batchtools.Rproj

NEWS.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
* Added a missing routine to upgrade registries created with batchtools prior to v0.9.3.
44
* Fixed a bug where the registry could not be synced if jobs failed during initialization (#135).
5+
* The sleep duration used in `waitForJobs()` and `submitJobs()` can now be set via the configuration file.
56
* A new heuristic will try to detect if the registry has been altered by a simultaneously running R session.
67
If this is detected, the registry will be set to a read-only state.
78
* New argument `writeable` for `loadRegistry()` to allow loading registries explicitly as read-only.

R/chunkIds.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ chunkIds = function(ids = NULL, n.chunks = NULL, chunk.size = NULL, group.by = c
2323

2424
if (length(group.by) > 0L) {
2525
job.id = NULL
26-
if (any(group.by %nin% names(ids)))
26+
if (any(group.by %chnin% names(ids)))
2727
stop("All columns to group by must be provided in the 'ids' table")
2828
ids[, "chunk" := chunk(job.id, n.chunks = n.chunks, chunk.size = chunk.size), by = group.by]
2929
ids[, "chunk" := .GRP, by = c(group.by, "chunk")]

R/clusterFunctions.R

+18-6
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,13 @@
3131
#' @param array.var [\code{character(1)}]\cr
3232
#' Name of the environment variable set by the scheduler to identify IDs of job arrays.
3333
#' Default is \code{NA} for no array support.
34-
#' @param store.job [\code{logical(1)}]\cr
34+
#' @param store.job.collection [\code{logical(1)}]\cr
3535
#' Flag to indicate that the cluster function implementation of \code{submitJob} can not directly handle \code{\link{JobCollection}} objects.
3636
#' If set to \code{FALSE}, the \code{\link{JobCollection}} is serialized to the file system before submitting the job.
37+
#' @param store.job.files [\code{logical(1)}]\cr
38+
#' Flag to indicate that job files need to be stored in the file directory.
39+
#' If set to \code{FALSE} (default), the job file is created in a temporary directory, otherwise (or if the debug mode is enabled) in
40+
#' the subdirectory \code{jobs} of the \code{file.dir}.
3741
#' @param scheduler.latency [\code{numeric(1)}]\cr
3842
#' Time to sleep after important interactions with the scheduler to ensure a sane state.
3943
#' Currently only triggered after calling \code{\link{submitJobs}}.
@@ -50,7 +54,8 @@
5054
#' @family ClusterFunctions
5155
#' @family ClusterFunctionsHelper
5256
makeClusterFunctions = function(name, submitJob, killJob = NULL, listJobsQueued = NULL, listJobsRunning = NULL,
53-
array.var = NA_character_, store.job = FALSE, scheduler.latency = 0, fs.latency = NA_real_, hooks = list()) {
57+
array.var = NA_character_, store.job.collection = FALSE, store.job.files = FALSE, scheduler.latency = 0,
58+
fs.latency = NA_real_, hooks = list()) {
5459
assertList(hooks, types = "function", names = "unique")
5560
assertSubset(names(hooks), unlist(batchtools$hooks, use.names = FALSE))
5661

@@ -61,7 +66,8 @@ makeClusterFunctions = function(name, submitJob, killJob = NULL, listJobsQueued
6166
listJobsQueued = assertFunction(listJobsQueued, "reg", null.ok = TRUE),
6267
listJobsRunning = assertFunction(listJobsRunning, "reg", null.ok = TRUE),
6368
array.var = assertString(array.var, na.ok = TRUE),
64-
store.job = assertFlag(store.job),
69+
store.job.collection = assertFlag(store.job.collection),
70+
store.job.files = assertFlag(store.job.files),
6571
scheduler.latency = assertNumber(scheduler.latency, lower = 0),
6672
fs.latency = assertNumber(fs.latency, lower = 0, na.ok = TRUE),
6773
hooks = hooks),
@@ -181,7 +187,11 @@ cfReadBrewTemplate = function(template, comment.string = NA_character_) {
181187
cfBrewTemplate = function(reg, text, jc) {
182188
assertString(text)
183189

184-
outfile = if (batchtools$debug) fp(reg$file.dir, "jobs", sprintf("%s.job", jc$job.hash)) else tempfile("job")
190+
outfile = if (batchtools$debug || reg$cluster.functions$store.job.files) {
191+
fp(reg$file.dir, "jobs", sprintf("%s.job", jc$job.hash))
192+
} else {
193+
tempfile(fileext = "job")
194+
}
185195
parent.env(jc) = asNamespace("batchtools")
186196
on.exit(parent.env(jc) <- emptyenv())
187197
"!DEBUG [cfBrewTemplate]: Brewing template to file '`outfile`'"
@@ -235,16 +245,18 @@ cfHandleUnknownSubmitError = function(cmd, exit.code, output) {
235245
#' @param max.tries [\code{integer(1)}]\cr
236246
#' Number of total times to try execute the OS command in cases of failures.
237247
#' Default is \code{3}.
248+
#' @inheritParams runOSCommand
238249
#' @return \code{TRUE} on success. An exception is raised otherwise.
239250
#' @family ClusterFunctionsHelper
240251
#' @export
241-
cfKillJob = function(reg, cmd, args = character(0L), max.tries = 3L) {
252+
cfKillJob = function(reg, cmd, args = character(0L), max.tries = 3L, nodename = "localhost") {
242253
assertString(cmd, min.chars = 1L)
243254
assertCharacter(args, any.missing = FALSE)
255+
assertString(nodename)
244256
max.tries = asCount(max.tries)
245257

246258
for (i in seq_len(max.tries)) {
247-
res = runOSCommand(cmd, args)
259+
res = runOSCommand(cmd, args, nodename = nodename)
248260
if (res$exit.code == 0L)
249261
return(TRUE)
250262
Sys.sleep(1)

R/clusterFunctionsDocker.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,6 @@ makeClusterFunctionsDocker = function(image, docker.args = character(0L), image.
108108
}
109109

110110
makeClusterFunctions(name = "Docker", submitJob = submitJob, killJob = killJob, listJobsRunning = listJobsRunning,
111-
store.job = TRUE, scheduler.latency = scheduler.latency, fs.latency = fs.latency,
111+
store.job.collection = TRUE, scheduler.latency = scheduler.latency, fs.latency = fs.latency,
112112
hooks = list(post.submit = housekeeping, post.sync = housekeeping))
113113
} # nocov end

R/clusterFunctionsInteractive.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ makeClusterFunctionsInteractive = function(external = FALSE, write.logs = TRUE,
3636
}
3737
}
3838

39-
makeClusterFunctions(name = "Interactive", submitJob = submitJob, store.job = external, fs.latency = fs.latency)
39+
makeClusterFunctions(name = "Interactive", submitJob = submitJob, store.job.collection = external, fs.latency = fs.latency)
4040
}

R/clusterFunctionsLSF.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,5 @@ makeClusterFunctionsLSF = function(template = "lsf", scheduler.latency = 1, fs.l
7373
}
7474

7575
makeClusterFunctions(name = "LSF", submitJob = submitJob, killJob = killJob, listJobsQueued = listJobsQueued,
76-
listJobsRunning = listJobsRunning, store.job = TRUE, scheduler.latency = scheduler.latency, fs.latency = fs.latency)
76+
listJobsRunning = listJobsRunning, store.job.collection = TRUE, scheduler.latency = scheduler.latency, fs.latency = fs.latency)
7777
} # nocov end

R/clusterFunctionsMulticore.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,5 @@ makeClusterFunctionsMulticore = function(ncpus = NA_integer_, fs.latency = NA_re
9999
}
100100

101101
makeClusterFunctions(name = "Multicore", submitJob = submitJob, listJobsRunning = listJobsRunning,
102-
store.job = FALSE, fs.latency = fs.latency, hooks = list(pre.sync = function(reg, fns) p$collect(1)))
102+
store.job.collection = FALSE, fs.latency = fs.latency, hooks = list(pre.sync = function(reg, fns) p$collect(1)))
103103
}

R/clusterFunctionsOpenLava.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,5 @@ makeClusterFunctionsOpenLava = function(template = "openlava", scheduler.latency
7373
}
7474

7575
makeClusterFunctions(name = "OpenLava", submitJob = submitJob, killJob = killJob, listJobsQueued = listJobsQueued,
76-
listJobsRunning = listJobsRunning, store.job = TRUE, scheduler.latency = scheduler.latency, fs.latency = fs.latency)
76+
listJobsRunning = listJobsRunning, store.job.collection = TRUE, scheduler.latency = scheduler.latency, fs.latency = fs.latency)
7777
} # nocov end

R/clusterFunctionsSGE.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,5 @@ makeClusterFunctionsSGE = function(template = "sge", scheduler.latency = 1, fs.l
6767
}
6868

6969
makeClusterFunctions(name = "SGE", submitJob = submitJob, killJob = killJob, listJobsQueued = listJobsQueued,
70-
listJobsRunning = listJobsRunning, store.job = TRUE, scheduler.latency = scheduler.latency, fs.latency = fs.latency)
70+
listJobsRunning = listJobsRunning, store.job.collection = TRUE, scheduler.latency = scheduler.latency, fs.latency = fs.latency)
7171
} # nocov end

R/clusterFunctionsSSH.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,5 @@ makeClusterFunctionsSSH = function(workers, fs.latency = 65) { # nocov start
6262
}
6363

6464
makeClusterFunctions(name = "SSH", submitJob = submitJob, killJob = killJob, listJobsRunning = listJobsRunning,
65-
store.job = TRUE, fs.latency = fs.latency)
65+
store.job.collection = TRUE, fs.latency = fs.latency)
6666
} # nocov end

R/clusterFunctionsSlurm.R

+15-6
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,23 @@
2626
#' Note that you should not select the cluster in your template file via \code{#SBATCH --clusters}.
2727
#' @param array.jobs [\code{logical(1)}]\cr
2828
#' If array jobs are disabled on the computing site, set to \code{FALSE}.
29+
#' @param nodename [\code{character(1)}]\cr
30+
#' Nodename of the master. All commands are send via SSH to this host. Only works iff
31+
#' \enumerate{
32+
#' \item{Passwordless authentication (e.g., via SSH public key authentication) is set up.}
33+
#' \item{The file directory is shared across machines, e.g. mounted via SSHFS.}
34+
#' \item{The absolute path to the \code{file.dir} are identical on the machines, or paths are provided relative to the
35+
#' home directory.}
36+
#' }
2937
#' @inheritParams makeClusterFunctions
3038
#' @return [\code{\link{ClusterFunctions}}].
3139
#' @family ClusterFunctions
3240
#' @export
33-
makeClusterFunctionsSlurm = function(template = "slurm", clusters = NULL, array.jobs = TRUE, scheduler.latency = 1, fs.latency = 65) { # nocov start
41+
makeClusterFunctionsSlurm = function(template = "slurm", clusters = NULL, array.jobs = TRUE, nodename = "localhost", scheduler.latency = 1, fs.latency = 65) { # nocov start
3442
if (!is.null(clusters))
3543
assertString(clusters, min.chars = 1L)
3644
assertFlag(array.jobs)
45+
assertString(nodename)
3746
template = findTemplateFile(template)
3847
template = cfReadBrewTemplate(template, "##")
3948

@@ -47,7 +56,7 @@ makeClusterFunctionsSlurm = function(template = "slurm", clusters = NULL, array.
4756
jc$log.file = stri_join(jc$log.file, "_%a")
4857
}
4958
outfile = cfBrewTemplate(reg, template, jc)
50-
res = runOSCommand("sbatch", shQuote(outfile))
59+
res = runOSCommand("sbatch", shQuote(outfile), nodename = nodename)
5160

5261
max.jobs.msg = "sbatch: error: Batch job submission failed: Job violates accounting policy (job submit limit, user's size and/or time limits)"
5362
temp.error = "Socket timed out on send/recv operation"
@@ -76,7 +85,7 @@ makeClusterFunctionsSlurm = function(template = "slurm", clusters = NULL, array.
7685
assertRegistry(reg, writeable = FALSE)
7786
if (array.jobs)
7887
args = c(args, "-r")
79-
res = runOSCommand("squeue", args)
88+
res = runOSCommand("squeue", args, nodename = nodename)
8089
if (res$exit.code > 0L)
8190
OSError("Listing of jobs failed", res)
8291
if (!is.null(clusters)) tail(res$output, -1L) else res$output
@@ -95,10 +104,10 @@ makeClusterFunctionsSlurm = function(template = "slurm", clusters = NULL, array.
95104
killJob = function(reg, batch.id) {
96105
assertRegistry(reg, writeable = TRUE)
97106
assertString(batch.id)
98-
cfKillJob(reg, "scancel", c(sprintf("--clusters=%s", clusters), batch.id))
107+
cfKillJob(reg, "scancel", c(sprintf("--clusters=%s", clusters), batch.id), nodename = nodename)
99108
}
100109

101110
makeClusterFunctions(name = "Slurm", submitJob = submitJob, killJob = killJob, listJobsRunning = listJobsRunning,
102-
listJobsQueued = listJobsQueued, array.var = "SLURM_ARRAY_TASK_ID", store.job = TRUE,
103-
scheduler.latency = scheduler.latency, fs.latency = fs.latency)
111+
listJobsQueued = listJobsQueued, array.var = "SLURM_ARRAY_TASK_ID", store.job.collection = TRUE,
112+
store.job.files = !isLocalHost(nodename), scheduler.latency = scheduler.latency, fs.latency = fs.latency)
104113
} # nocov end

R/clusterFunctionsSocket.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,5 @@ makeClusterFunctionsSocket = function(ncpus = NA_integer_, fs.latency = 65) {
7171
}
7272

7373
makeClusterFunctions(name = "Socket", submitJob = submitJob, listJobsRunning = listJobsRunning,
74-
store.job = FALSE, fs.latency = fs.latency, hooks = list(pre.sync = function(reg, fns) p$list()))
74+
store.job.collection = FALSE, fs.latency = fs.latency, hooks = list(pre.sync = function(reg, fns) p$list()))
7575
}

R/clusterFunctionsTORQUE.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,6 @@ makeClusterFunctionsTORQUE = function(template = "torque", scheduler.latency = 1
7373
}
7474

7575
makeClusterFunctions(name = "TORQUE", submitJob = submitJob, killJob = killJob, listJobsQueued = listJobsQueued,
76-
listJobsRunning = listJobsRunning, array.var = "PBS_ARRAYID", store.job = TRUE,
76+
listJobsRunning = listJobsRunning, array.var = "PBS_ARRAYID", store.job.collection = TRUE,
7777
scheduler.latency = scheduler.latency, fs.latency = fs.latency)
7878
} # nocov end

R/findJobs.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ findExpired = function(ids = NULL, reg = getDefaultRegistry()) {
258258

259259
.findExpired = function(reg, ids = NULL, batch.ids = getBatchIds(reg)) {
260260
submitted = done = batch.id = NULL
261-
filter(reg$status, ids, c("job.id", "submitted", "done", "batch.id"))[!is.na(submitted) & is.na(done) & batch.id %nin% batch.ids$batch.id, "job.id"]
261+
filter(reg$status, ids, c("job.id", "submitted", "done", "batch.id"))[!is.na(submitted) & is.na(done) & batch.id %chnin% batch.ids$batch.id, "job.id"]
262262
}
263263

264264
#' @export

R/helpers.R

+5-1
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,17 @@ stopf = function (...) {
9898
!match(x, y, nomatch = 0L)
9999
}
100100

101+
`%chnin%` = function(x, y) {
102+
!chmatch(x, y, nomatch = 0L)
103+
}
104+
101105
setClasses = function(x, cl) {
102106
setattr(x, "class", cl)
103107
x
104108
}
105109

106110
addlevel = function(x, lvl) {
107-
if (lvl %nin% levels(x))
111+
if (lvl %chnin% levels(x))
108112
levels(x) = c(levels(x), lvl)
109113
x
110114
}

R/runOSCommand.R

+8-4
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ runOSCommand = function(sys.cmd, sys.args = character(0L), stdin = "", nodename
2828
assertCharacter(sys.args, any.missing = FALSE)
2929
assertString(nodename, min.chars = 1L)
3030

31-
if (nodename != "localhost") {
32-
sys.args = c(nodename, shQuote(stri_flatten(c(sys.cmd, sys.args), " ")))
31+
if (!isLocalHost(nodename)) {
32+
sys.args = c("-q", nodename, shQuote(stri_flatten(c(sys.cmd, sys.args), " ")))
3333
sys.cmd = "ssh"
3434
}
3535

@@ -50,7 +50,11 @@ runOSCommand = function(sys.cmd, sys.args = character(0L), stdin = "", nodename
5050
return(list(sys.cmd = sys.cmd, sys.args = sys.args, exit.code = exit.code, output = output))
5151
}
5252

53+
isLocalHost = function(nodename) {
54+
is.null(nodename) || nodename %chin% c("localhost", "127.0.0.1", "::1")
55+
}
56+
5357
OSError = function(msg, res) {
54-
stopf("%s (exit code %i); cmd: '%s'; output: %s",
55-
msg, res$exit.code, stri_flatten(c(res$sys.cmd, res$sys.args), collapse = " "), res$output)
58+
stopf("%s (exit code %i);\ncmd: '%s'\noutput:\n%s",
59+
msg, res$exit.code, stri_flatten(c(res$sys.cmd, res$sys.args), collapse = " "), stri_flatten(res$output, "\n"))
5660
}

R/sleep.R

+16-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
1-
default.sleep = function(i) {
2-
5 + 115 * pexp(i - 1, rate = 0.01)
3-
}
1+
getSleepFunction = function(reg, sleep) {
2+
if (is.null(sleep)) {
3+
if (is.null(reg$sleep))
4+
return(function(i) { 5 + 115 * pexp(i - 1, rate = 0.01) })
5+
sleep = reg$sleep
6+
}
7+
8+
if (is.numeric(sleep)) {
9+
assertNumber(sleep, lower = 0)
10+
return(function(i) Sys.sleep(sleep))
11+
}
12+
13+
if (is.function(sleep)) {
14+
return(function(i) Sys.sleep(sleep(i)))
15+
}
416

5-
getSleepFunction = function(sleep) {
6-
assert(checkNumber(sleep, lower = 0), checkFunction(sleep, args = "i"))
7-
if (is.numeric(sleep))
8-
function(i) Sys.sleep(sleep)
9-
else
10-
function(i) Sys.sleep(sleep(i))
17+
stop("Argument 'sleep' must be either a numeric value or function(i)")
1118
}

R/submitJobs.R

+8-5
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,11 @@
5454
#' Defaults can be stored in the configuration file by providing the named list \code{default.resources}.
5555
#' Settings in \code{resources} overwrite those in \code{default.resources}.
5656
#' @param sleep [\code{function(i)} | \code{numeric(1)}]\cr
57-
#' Function which returns the duration to sleep in the \code{i}-th iteration between temporary errors.
58-
#' Alternatively, you can pass a single positive numeric value.
57+
#' Parameter to control the duration to sleep between temporary errors.
58+
#' You can pass an absolute numeric value in seconds or a \code{function(i)} which returns the number of seconds to sleep in the \code{i}-th
59+
#' iteration between temporary errors.
60+
#' If not provided (\code{NULL}), tries to read the value (number/function) from the configuration file (stored in \code{reg$sleep}) or defaults to
61+
#' a function with exponential backoff between 5 and 120 seconds.
5962
#' @template reg
6063
#' @return [\code{\link{data.table}}] with columns \dQuote{job.id} and \dQuote{chunk}.
6164
#' @export
@@ -114,7 +117,7 @@
114117
#' # There should also be a note in the log:
115118
#' grepLogs(pattern = "parallelMap", reg = tmp)
116119
#' }
117-
submitJobs = function(ids = NULL, resources = list(), sleep = default.sleep, reg = getDefaultRegistry()) {
120+
submitJobs = function(ids = NULL, resources = list(), sleep = NULL, reg = getDefaultRegistry()) {
118121
assertRegistry(reg, writeable = TRUE, sync = TRUE)
119122
assertList(resources, names = "strict")
120123
resources = insert(reg$default.resources, resources)
@@ -133,7 +136,7 @@ submitJobs = function(ids = NULL, resources = list(), sleep = default.sleep, reg
133136
resources$chunks.as.arrayjobs = NULL
134137
}
135138
}
136-
sleep = getSleepFunction(sleep)
139+
sleep = getSleepFunction(reg, sleep)
137140

138141
ids = convertIds(reg, ids, default = .findNotSubmitted(reg = reg), keep.extra = "chunk")
139142
if (nrow(ids) == 0L)
@@ -185,7 +188,7 @@ submitJobs = function(ids = NULL, resources = list(), sleep = default.sleep, reg
185188
for (ch in chunks) {
186189
ids.chunk = ids[chunk == ch, "job.id"]
187190
jc = makeJobCollection(ids.chunk, resources = resources, reg = reg)
188-
if (reg$cluster.functions$store.job)
191+
if (reg$cluster.functions$store.job.collection)
189192
writeRDS(jc, file = jc$uri)
190193

191194
if (!is.na(max.concurrent.jobs)) {

R/updateRegisty.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ updateRegistry = function(reg = getDefaultRegistry()) { # nocov start
1717
}
1818

1919
### hotfix for log.file column
20-
if ("log.file" %nin% names(reg$status)) {
20+
if ("log.file" %chnin% names(reg$status)) {
2121
info("Adding column 'log.file'")
2222
reg$status[, ("log.file") := rep(NA_character_, .N)]
2323
}
@@ -44,7 +44,7 @@ updateRegistry = function(reg = getDefaultRegistry()) { # nocov start
4444
}
4545

4646
if (reg$version < "0.9.4-9001") {
47-
if ("job.name" %nin% names(reg$status)) {
47+
if ("job.name" %chnin% names(reg$status)) {
4848
info("Adding column 'job.name'")
4949
reg$status[, ("job.name") := rep(NA_character_, .N)]
5050
}

R/waitForJobs.R

+8-4
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@
66
#' @templateVar ids.default findSubmitted
77
#' @template ids
88
#' @param sleep [\code{function(i)} | \code{numeric(1)}]\cr
9-
#' Function which returns the duration to sleep in the \code{i}-th iteration.
10-
#' Alternatively, you can pass a single positive numeric value.
9+
#' Parameter to control the duration to sleep between queries.
10+
#' You can pass an absolute numeric value in seconds or a \code{function(i)} which returns
11+
#' the number of seconds to sleep in the \code{i}-th iteration.
12+
#' If not provided (\code{NULL}), tries to read the value (number/function) from the configuration file
13+
#' (stored in \code{reg$sleep}) or defaults to a function with exponential backoff between
14+
#' 5 and 120 seconds.
1115
#' @param timeout [\code{numeric(1)}]\cr
1216
#' After waiting \code{timeout} seconds, show a message and return
1317
#' \code{FALSE}. This argument may be required on some systems where, e.g.,
@@ -21,11 +25,11 @@
2125
#' successfully and \code{FALSE} if either the timeout is reached or at least
2226
#' one job terminated with an exception.
2327
#' @export
24-
waitForJobs = function(ids = NULL, sleep = default.sleep, timeout = 604800, stop.on.error = FALSE, reg = getDefaultRegistry()) {
28+
waitForJobs = function(ids = NULL, sleep = NULL, timeout = 604800, stop.on.error = FALSE, reg = getDefaultRegistry()) {
2529
assertRegistry(reg, writeable = FALSE, sync = TRUE)
2630
assertNumber(timeout, lower = 0)
2731
assertFlag(stop.on.error)
28-
sleep = getSleepFunction(sleep)
32+
sleep = getSleepFunction(reg, sleep)
2933
ids = convertIds(reg, ids, default = .findSubmitted(reg = reg))
3034

3135
.findNotTerminated = function(reg, ids = NULL) {

0 commit comments

Comments
 (0)