Skip to content

Commit 0d02983

Browse files
committed
wait for brewed file before submit
1 parent e5b4711 commit 0d02983

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

R/clusterFunctions.R

+5-5
Original file line numberDiff line numberDiff line change
@@ -187,18 +187,18 @@ cfReadBrewTemplate = function(template, comment.string = NA_character_) {
187187
cfBrewTemplate = function(reg, text, jc) {
188188
assertString(text)
189189

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-
}
190+
path = if (batchtools$debug || reg$cluster.functions$store.job.files) fp(reg$file.dir, "jobs") else tempdir()
191+
fn = sprintf("%s.job", jc$job.hash)
192+
outfile = fp(path, fn)
193+
195194
parent.env(jc) = asNamespace("batchtools")
196195
on.exit(parent.env(jc) <- emptyenv())
197196
"!DEBUG [cfBrewTemplate]: Brewing template to file '`outfile`'"
198197

199198
z = try(brew(text = text, output = outfile, envir = jc), silent = TRUE)
200199
if (is.error(z))
201200
stopf("Error brewing template: %s", as.character(z))
201+
waitForFiles(path, fn, reg$cluster.functions$scheduler.latency)
202202
return(outfile)
203203
}
204204

0 commit comments

Comments
 (0)