Skip to content

Commit 2b31d11

Browse files
Introduced option 'future.batchtools.delete' (character), and re-introduced option 'future.delete' (logical) for backward compatible reasons. The latter is only queried when the package is loaded and, if set, sets option 'future.batchtools.delete' unless that is also set
1 parent 84cabe9 commit 2b31d11

29 files changed

+86
-39
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-9964
2+
Version: 0.12.2-9965
33
Depends:
44
R (>= 3.2.0),
55
parallelly,

NEWS.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
* **future.batchtools** now implements the FutureBackend API
66
introduced in **future** 1.40.0 (2025-04-10).
77

8-
* Removed option `future.delete`. To control whether batchtools
9-
futures should be deleted from the file system, see future backend
10-
argument `delete`, which defaults to `"on-success"`, but can also
11-
be set to `"never"` and `"always"`.
12-
138
## New Features
149

10+
* Batchtools future backends gained argument `delete` for controlling
11+
if and when batchtools futures should be deleted from the file
12+
system`. Supported values are `"on-success"`, `"never"` and
13+
`"always"`. The default value can be set via R option
14+
`future.batchtools.delete`.
15+
1516
* Most types of batchtools future can now be interrupted, including
1617
`batchtools_multicore` and all job-scheduler backends, e.g.
1718
`batchtools_sge` and `batchtools_slurm`.
@@ -52,6 +53,16 @@
5253
**future.batchtools** will no longer wait for such files and only
5354
read their content if they exists when checked.
5455

56+
## Deprecated and Defunct
57+
58+
* R option `future.delete` is deprecated. Please use new R option
59+
`future.batchtools.delete` instead. For backward compatible
60+
reasons, if R option `future.delete` sets option
61+
`future.batchtools.delete` when the packages is loaded and the
62+
latter is not already set. If `future.delete` is FALSE, then
63+
`future.batchtools.delete` is set to `"never"`. If `future.delete`
64+
is TRUE, then `future.batchtools.delete` is set to `"on-success"`.
65+
5566

5667
# Version 0.12.2 [2025-06-06]
5768

@@ -177,19 +188,16 @@
177188
`status()`, which were functions that were used for internal
178189
purposes.
179190

180-
181191
## Documentation
182192

183193
* Document option `future.delete` and clarify option
184194
`future.cache.path` in `help("future.batchtools.options")`.
185195

186-
187196
## Bug Fixes
188197

189198
* If `run()` was called twice for a BatchtoolsFuture, it would not
190199
produce a FutureError but only a regular non-classed error.
191200

192-
193201
## Deprecated and Defunct
194202

195203
* Removed S3 generic functions `await()`, `finished()`, and

R/BatchtoolsFutureBackend-class.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ BatchtoolsFutureBackend <- function(
5353
registry = list(),
5454
conf.file = findConfFile(),
5555
interrupts = TRUE,
56-
delete = "on-success",
56+
delete = getOption("future.batchtools.debug", "on-success"),
5757
...) {
5858
assert_no_positional_args_but_first()
5959

@@ -979,7 +979,7 @@ delete.BatchtoolsFuture <- function(future,
979979
if (debug) mdebugf("delete(): %s", msg)
980980
warning(msg)
981981
return(invisible(FALSE))
982-
}
982+
}
983983
}
984984
}
985985

R/BatchtoolsTemplateFutureBackend-class.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
#' @importFrom batchtools makeClusterFunctionsSlurm
4848
#' @importFrom batchtools makeClusterFunctionsTORQUE
4949
#' @export
50-
BatchtoolsTemplateFutureBackend <- function(type, scheduler.latency = 1.0, fs.latency = 65.0, resources = list(), delete = "on-success", template = NULL, makeClusterFunctions = NULL, workers = getOption("future.batchtools.workers", default = 100L), ...) {
50+
BatchtoolsTemplateFutureBackend <- function(type, scheduler.latency = 1.0, fs.latency = 65.0, resources = list(), delete = getOption("future.batchtools.delete", "on-success"), template = NULL, makeClusterFunctions = NULL, workers = getOption("future.batchtools.workers", default = 100L), ...) {
5151
assert_no_positional_args_but_first()
5252
stop_if_not(
5353
is.character(type),

R/batchtools_bash.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ BatchtoolsBashFutureBackend <- function(..., template = "bash", fs.latency = 0.0
7676
#' print(info)
7777
#'
7878
#' @export
79-
batchtools_bash <- function(..., template = "bash", fs.latency = 0.0, resources = list(), delete = "on-success") {
79+
batchtools_bash <- function(..., template = "bash", fs.latency = 0.0, resources = list(), delete = getOption("future.batchtools.delete", "on-success")) {
8080
stop("INTERNAL ERROR: The future.batchtools::batchtools_bash() must never be called directly")
8181
}
8282
class(batchtools_bash) <- c(

R/batchtools_interactive.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ BatchtoolsInteractiveFutureBackend <- function(fs.latency = 0.0, ...) {
6262
#' @inheritParams BatchtoolsInteractiveFutureBackend
6363
#'
6464
#' @export
65-
batchtools_interactive <- function(..., fs.latency = 0.0, delete = "on-success") {
65+
batchtools_interactive <- function(..., fs.latency = 0.0, delete = getOption("future.batchtools.delete", "on-success")) {
6666
stop("INTERNAL ERROR: The future.batchtools::batchtools_interactive() must never be called directly")
6767
}
6868
class(batchtools_interactive) <- c(

R/batchtools_local.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ BatchtoolsLocalFutureBackend <- function(fs.latency = 0.0, ...) {
9292
#' print(info)
9393
#'
9494
#' @export
95-
batchtools_local <- function(..., fs.latency = 0.0, delete = "on-success") {
95+
batchtools_local <- function(..., fs.latency = 0.0, delete = getOption("future.batchtools.delete", "on-success")) {
9696
stop("INTERNAL ERROR: The future.batchtools::batchtools_local() must never be called directly")
9797
}
9898
class(batchtools_local) <- c(

R/batchtools_lsf.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ BatchtoolsLsfFutureBackend <- function(...) {
5959
#' * <https://en.wikipedia.org/wiki/IBM_Spectrum_LSF>
6060
#'
6161
#' @export
62-
batchtools_lsf <- function(..., template = "lsf", scheduler.latency = 1.0, fs.latency = 65.0, resources = list(), delete = "on-success", workers = getOption("future.batchtools.workers", default = 100L)) {
62+
batchtools_lsf <- function(..., template = "lsf", scheduler.latency = 1.0, fs.latency = 65.0, resources = list(), delete = getOption("future.batchtools.delete", "on-success"), workers = getOption("future.batchtools.workers", default = 100L)) {
6363
stop("INTERNAL ERROR: The future.batchtools::batchtools_lsf() must never be called directly")
6464
}
6565
class(batchtools_lsf) <- c(

R/batchtools_multicore.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#' @importFrom parallelly availableCores supportsMulticore
3232
#' @importFrom tools pskill
3333
#' @export
34-
BatchtoolsMulticoreFutureBackend <- function(workers = availableCores(constraints = "multicore"), fs.latency = 0.0, delete = "on-success", ...) {
34+
BatchtoolsMulticoreFutureBackend <- function(workers = availableCores(constraints = "multicore"), fs.latency = 0.0, delete = getOption("future.batchtools.delete", "on-success"), ...) {
3535
assert_no_positional_args_but_first()
3636

3737
if (is.function(workers)) workers <- workers()
@@ -103,7 +103,7 @@ BatchtoolsMulticoreFutureBackend <- function(workers = availableCores(constraint
103103
#' print(info)
104104
#'
105105
#' @export
106-
batchtools_multicore <- function(..., workers = availableCores(constraints = "multicore"), fs.latency = 0.0, delete = "on-success") {
106+
batchtools_multicore <- function(..., workers = availableCores(constraints = "multicore"), fs.latency = 0.0, delete = getOption("future.batchtools.delete", "on-success")) {
107107
stop("INTERNAL ERROR: The future.batchtools::batchtools_multicore() must never be called directly")
108108
}
109109
class(batchtools_multicore) <- c(

R/batchtools_openlava.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ BatchtoolsOpenLavaFutureBackend <- function(...) {
5959
#' * <https://en.wikipedia.org/wiki/OpenLava>
6060
#'
6161
#' @export
62-
batchtools_openlava <- function(..., template = "openlava", scheduler.latency = 1.0, fs.latency = 65.0, resources = list(), delete = "on-success", workers = getOption("future.batchtools.workers", default = 100L)) {
62+
batchtools_openlava <- function(..., template = "openlava", scheduler.latency = 1.0, fs.latency = 65.0, resources = list(), delete = getOption("future.batchtools.delete", "on-success"), workers = getOption("future.batchtools.workers", default = 100L)) {
6363
stop("INTERNAL ERROR: The future.batchtools::batchtools_openlava() must never be called directly")
6464
}
6565
class(batchtools_openlava) <- c(

0 commit comments

Comments
 (0)