Skip to content

Commit cb668b0

Browse files
BatchtoolsFutureBackend gained explicit argument 'interrupts = TRUE'
1 parent 92cb9cc commit cb668b0

File tree

4 files changed

+22
-5
lines changed

4 files changed

+22
-5
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.12.2-9909
2+
Version: 0.12.2-9910
33
Depends:
44
R (>= 3.2.0),
55
parallelly,

NEWS.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@
99

1010
* Most types of batchtools future can now be interrupted, including
1111
`batchtools_multicore` and all job-scheduler backends, e.g.
12-
`batchtools_sge` and `batchtools_slurm`.
13-
12+
`batchtools_sge` and `batchtools_slurm`.
13+
14+
* Canceling of batchtools future will now interrupt them by default,
15+
for backends where it is supported.
16+
1417

1518
# Version 0.12.2 [2025-06-06]
1619

R/BatchtoolsFuture-class.R

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#' A batchtools future is a future whose value will be resolved via batchtools
22
#'
3+
#' @inheritParams future::FutureBackend
4+
#'
35
#' @param resources (optional) A named list passed to the \pkg{batchtools}
46
#' template (available as variable `resources`). See Section 'Resources'
57
#' in [batchtools::submitJobs()] more details.
@@ -39,6 +41,7 @@ BatchtoolsFutureBackend <- function(workers = NULL, resources = list(),
3941
conf.file = findConfFile(),
4042
cluster.functions = NULL,
4143
registry = list(),
44+
interrupts = TRUE,
4245
...) {
4346
assert_no_positional_args_but_first()
4447

@@ -79,7 +82,7 @@ BatchtoolsFutureBackend <- function(workers = NULL, resources = list(),
7982
}
8083

8184
stop_if_not(is.list(resources))
82-
85+
8386
core <- FutureBackend(
8487
reg = "workers-batchtools",
8588
workers = workers,
@@ -88,6 +91,7 @@ BatchtoolsFutureBackend <- function(workers = NULL, resources = list(),
8891
cluster.functions = cluster.functions,
8992
registry = registry,
9093
finalize = finalize,
94+
interrupts = interrupts,
9195
future.wait.timeout = getOption("future.wait.timeout", 30 * 24 * 60 * 60),
9296
future.wait.interval = getOption("future.wait.interval", 0.01),
9397
future.wait.alpha = getOption("future.wait.alpha", 1.01),
@@ -343,7 +347,12 @@ interruptFuture.BatchtoolsFutureBackend <- function(backend, future, ...) {
343347
mdebug_pop()
344348
})
345349
}
346-
350+
351+
if (!backend[["interrupts"]]) {
352+
if (debug) mdebug("Interrupts are disabled for the current backend")
353+
return(future)
354+
}
355+
347356
config <- future[["config"]]
348357
reg <- config[["reg"]]
349358

man/BatchtoolsFuture.Rd

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)