Skip to content

Commit 34ff960

Browse files
Make sure to call specific BatchtoolsNNNFuture constructors
1 parent c5a2941 commit 34ff960

File tree

4 files changed

+19
-12
lines changed

4 files changed

+19
-12
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: future.batchtools
2-
Version: 0.10.0-9028
2+
Version: 0.10.0-9029
33
Depends:
44
R (>= 3.2.0),
55
parallelly,

R/BatchtoolsMultiprocessFuture-class.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ BatchtoolsTemplateFuture <- function(expr = NULL, substitute = TRUE, envir = par
3939
BatchtoolsLsfFuture <- function(expr = NULL, substitute = TRUE, envir = parent.frame(), ...) {
4040
if (substitute) expr <- substitute(expr)
4141

42-
future <- BatchtoolsMultiprocessFuture(expr = expr, substitute = FALSE, envir = envir, ...)
42+
future <- BatchtoolsTemplateFuture(expr = expr, substitute = FALSE, envir = envir, ...)
4343
future <- structure(future, class = c("BatchtoolsLsfFuture", class(future)))
4444

4545
future
@@ -51,7 +51,7 @@ BatchtoolsLsfFuture <- function(expr = NULL, substitute = TRUE, envir = parent.f
5151
BatchtoolsOpenLavaFuture <- function(expr = NULL, substitute = TRUE, envir = parent.frame(), ...) {
5252
if (substitute) expr <- substitute(expr)
5353

54-
future <- BatchtoolsMultiprocessFuture(expr = expr, substitute = FALSE, envir = envir, ...)
54+
future <- BatchtoolsTemplateFuture(expr = expr, substitute = FALSE, envir = envir, ...)
5555
future <- structure(future, class = c("BatchtoolsOpenLavaFuture", class(future)))
5656

5757
future
@@ -63,7 +63,7 @@ BatchtoolsOpenLavaFuture <- function(expr = NULL, substitute = TRUE, envir = par
6363
BatchtoolsSGEFuture <- function(expr = NULL, substitute = TRUE, envir = parent.frame(), ...) {
6464
if (substitute) expr <- substitute(expr)
6565

66-
future <- BatchtoolsMultiprocessFuture(expr = expr, substitute = FALSE, envir = envir, ...)
66+
future <- BatchtoolsTemplateFuture(expr = expr, substitute = FALSE, envir = envir, ...)
6767
future <- structure(future, class = c("BatchtoolsSGEFuture", class(future)))
6868

6969
future
@@ -75,7 +75,7 @@ BatchtoolsSGEFuture <- function(expr = NULL, substitute = TRUE, envir = parent.f
7575
BatchtoolsSlurmFuture <- function(expr = NULL, substitute = TRUE, envir = parent.frame(), ...) {
7676
if (substitute) expr <- substitute(expr)
7777

78-
future <- BatchtoolsMultiprocessFuture(expr = expr, substitute = FALSE, envir = envir, ...)
78+
future <- BatchtoolsTemplateFuture(expr = expr, substitute = FALSE, envir = envir, ...)
7979
future <- structure(future, class = c("BatchtoolsSlurmFuture", class(future)))
8080

8181
future
@@ -87,7 +87,7 @@ BatchtoolsSlurmFuture <- function(expr = NULL, substitute = TRUE, envir = parent
8787
BatchtoolsTorqueFuture <- function(expr = NULL, substitute = TRUE, envir = parent.frame(), ...) {
8888
if (substitute) expr <- substitute(expr)
8989

90-
future <- BatchtoolsMultiprocessFuture(expr = expr, substitute = FALSE, envir = envir, ...)
90+
future <- BatchtoolsTemplateFuture(expr = expr, substitute = FALSE, envir = envir, ...)
9191
future <- structure(future, class = c("BatchtoolsTorqueFuture", class(future)))
9292

9393
future

R/batchtools_template.R

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,14 @@ batchtools_by_template <- function(expr, envir = parent.frame(),
183183
torque = makeClusterFunctionsTORQUE
184184
)
185185

186+
constructor <- switch(type,
187+
lsf = BatchtoolsLsfFuture,
188+
openlava = BatchtoolsOpenLavaFuture,
189+
sge = BatchtoolsSGEFuture,
190+
slurm = BatchtoolsSlurmFuture,
191+
torque = BatchtoolsTorqueFuture
192+
)
193+
186194
make_cfs_formals <- formals(make_cfs)
187195

188196
## Get the default template?
@@ -204,7 +212,7 @@ batchtools_by_template <- function(expr, envir = parent.frame(),
204212
if (length(keep) > 0) dotdotdot <- dotdotdot[-keep]
205213

206214
args <- list(
207-
expr = expr, envir = envir, substitute = FALSE,
215+
expr = expr, substitute = FALSE, envir = envir,
208216
globals = globals,
209217
label = label,
210218
cluster.functions = cluster.functions,
@@ -213,7 +221,7 @@ batchtools_by_template <- function(expr, envir = parent.frame(),
213221
workers = workers
214222
)
215223
if (length(dotdotdot) > 0) args <- c(args, dotdotdot)
216-
future <- do.call(BatchtoolsTemplateFuture, args = args)
224+
future <- do.call(constructor, args = args)
217225

218226
if (!future$lazy) future <- run(future)
219227

inst/templates/slurm.tmpl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,16 @@
55
# Author: Henrik Bengtsson
66
######################################################################
77

8-
#SBATCH --job-name=<%= if (exists("job.name", mode = "character")) job.name else job.hash %>
9-
#SBATCH --output=<%= log.file %>-%j.out
10-
#SBATCH --mail-type=END,FAIL
8+
#SBATCH --job-name=<%= job.name %>
9+
#SBATCH --output=<%= log.file %>
1110
#SBATCH --nodes=1
1211
#SBATCH --time=00:05:00
1312

1413
## Resources needed:
1514
<% if (length(resources) > 0) {
1615
opts <- unlist(resources, use.names = TRUE)
1716
opts <- sprintf("--%s=%s", names(opts), opts)
18-
opts <- paste(opts, collapse = ",") %>
17+
opts <- paste(opts, collapse = " ") %>
1918
#SBATCH <%= opts %>
2019
<% } %>
2120

0 commit comments

Comments
 (0)