Skip to content

Commit d518ae8

Browse files
Merge branch 'release/0.7.1'
2 parents 95095d9 + 70d7923 commit d518ae8

29 files changed

+500
-345
lines changed

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: future.batchtools
2-
Version: 0.7.0
2+
Version: 0.7.1
33
Depends:
44
R (>= 3.2.0),
55
future (>= 1.8.1)
@@ -20,7 +20,7 @@ Description: Implementation of the Future API on top of the 'batchtools' package
2020
in parallel out of the box, not only on your local machine or ad-hoc
2121
cluster of machines, but also via high-performance compute ('HPC') job
2222
schedulers such as 'LSF', 'OpenLava', 'Slurm', 'SGE', and 'TORQUE' / 'PBS',
23-
e.g. 'y <- future_lapply(files, FUN = process)'.
23+
e.g. 'y <- future.apply::future_lapply(files, FUN = process)'.
2424
License: LGPL (>= 2.1)
2525
LazyLoad: TRUE
2626
URL: https://github.com/HenrikBengtsson/future.batchtools

NAMESPACE

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ S3method(loggedOutput,BatchtoolsFuture)
88
S3method(nbrOfWorkers,batchtools)
99
S3method(print,BatchtoolsFuture)
1010
S3method(resolved,BatchtoolsFuture)
11+
S3method(result,BatchtoolsFuture)
1112
S3method(status,BatchtoolsFuture)
12-
S3method(value,BatchtoolsFuture)
1313
export("%resources%")
1414
export(BatchtoolsFuture)
1515
export(BatchtoolsFutureError)
@@ -26,7 +26,6 @@ export(finished)
2626
export(loggedError)
2727
export(loggedOutput)
2828
export(status)
29-
export(value)
3029
importFrom(batchtools,batchExport)
3130
importFrom(batchtools,batchMap)
3231
importFrom(batchtools,clearRegistry)
@@ -55,8 +54,8 @@ importFrom(future,getGlobalsAndPackages)
5554
importFrom(future,nbrOfWorkers)
5655
importFrom(future,plan)
5756
importFrom(future,resolved)
57+
importFrom(future,result)
5858
importFrom(future,tweak)
59-
importFrom(future,value)
6059
importFrom(utils,capture.output)
6160
importFrom(utils,file_test)
6261
importFrom(utils,sessionInfo)

NEWS

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
Package: future.batchtools
22
==========================
33

4+
Version: 0.7.1 [2018-07-18]
5+
6+
NEW FEATURES:
7+
8+
o The batchtools_* backends support the handling of the standard output as
9+
implemented in future (>= 1.9.0).
10+
11+
BUG FIXES:
12+
13+
o A bug was introduced in future.batchtools 0.7.0 that could result in "Error
14+
in readLog(id, reg = reg) : Log file for job with id 1 not available" when
15+
using one of the batchtools backends. It occurred when the value was
16+
queried. It was observered using 'batchtools_torque' but not when using
17+
'batchools_local'. This bug was missed because the 0.7.0 release was not
18+
tested on an TORQUE/PBS HPC scheduler as it should have.
19+
20+
421
Version: 0.7.0 [2018-05-03]
522

623
NEW FEATURES:
@@ -36,7 +53,7 @@ NEW FEATURES:
3653

3754
o The error message for expired batchtools futures now include the last few
3855
lines of the logged output, which sometimes includes clues on why the future
39-
expired. For instance, if a TORQUE / PBS job use more than the allocated
56+
expired. For instance, if a TORQUE/PBS job use more than the allocated
4057
amount of memory it might be terminated by the scheduler leaving the message
4158
"PBS: job killed: vmem 1234000 exceeded limit 1048576" in the output.
4259

R/BatchtoolsFuture-class.R

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ BatchtoolsFuture <- function(expr = NULL, envir = parent.frame(),
7676
gp <- getGlobalsAndPackages(expr, envir = envir, globals = globals)
7777

7878
future <- Future(expr = gp$expr, envir = envir, substitute = FALSE,
79-
workers = workers, label = label, version = "1.8", ...)
79+
workers = workers, label = label,
80+
version = "1.8", .callResult = TRUE,
81+
...)
8082

8183
future$globals <- gp$globals
8284
future$packages <- unique(c(packages, gp$packages))
@@ -112,7 +114,7 @@ BatchtoolsFuture <- function(expr = NULL, envir = parent.frame(),
112114
#' @export
113115
#' @keywords internal
114116
print.BatchtoolsFuture <- function(x, ...) {
115-
NextMethod("print")
117+
NextMethod()
116118

117119
## batchtools specific
118120
reg <- x$config$reg
@@ -152,14 +154,13 @@ loggedOutput <- function(...) UseMethod("loggedOutput")
152154
#'
153155
#' @return A character vector or a logical scalar.
154156
#'
155-
#' @aliases status finished value
157+
#' @aliases status finished result
156158
#' loggedError loggedOutput
157159
#' @keywords internal
158160
#'
159161
#' @export
160162
#' @export status
161163
#' @export finished
162-
#' @export value
163164
#' @export loggedError
164165
#' @export loggedOutput
165166
#' @importFrom batchtools getStatus
@@ -192,13 +193,15 @@ status.BatchtoolsFuture <- function(future, ...) {
192193
status <- status[status]
193194
status <- sort(names(status))
194195
status <- setdiff(status, c("n"))
196+
197+
status[status == "done"] <- "finished"
195198

196199
result <- future$result
197200
if (inherits(result, "FutureResult")) {
198201
condition <- result$condition
199202
if (inherits(condition, "error")) status <- c("error", status)
200203
}
201-
204+
202205
status
203206
}
204207

@@ -208,7 +211,7 @@ status.BatchtoolsFuture <- function(future, ...) {
208211
finished.BatchtoolsFuture <- function(future, ...) {
209212
status <- status(future)
210213
if (is_na(status)) return(NA)
211-
any(c("done", "error", "expired") %in% status)
214+
any(c("finished", "error", "expired") %in% status)
212215
}
213216

214217
#' @export
@@ -265,25 +268,27 @@ loggedOutput.BatchtoolsFuture <- function(future, ...) {
265268
#' @keywords internal
266269
resolved.BatchtoolsFuture <- function(x, ...) {
267270
## Has internal future state already been switched to be resolved
268-
resolved <- NextMethod("resolved")
271+
resolved <- NextMethod()
269272
if (resolved) return(TRUE)
270273

271274
## If not, checks the batchtools registry status
272275
resolved <- finished(x)
273276
if (is.na(resolved)) return(FALSE)
274-
277+
275278
resolved
276279
}
277280

278-
#' @importFrom future value
281+
#' @importFrom future result
279282
#' @export
280283
#' @keywords internal
281-
value.BatchtoolsFuture <- function(future, signal = TRUE,
282-
onMissing = c("default", "error"),
283-
default = NULL, cleanup = TRUE, ...) {
284+
result.BatchtoolsFuture <- function(future, cleanup = TRUE, ...) {
284285
## Has the value already been collected?
285-
if (future$state %in% c("done", "failed", "interrupted")) {
286-
return(NextMethod("value"))
286+
result <- future$result
287+
if (inherits(result, "FutureResult")) return(result)
288+
289+
## Has the value already been collected? - take two
290+
if (future$state %in% c("finished", "failed", "interrupted")) {
291+
return(NextMethod())
287292
}
288293

289294
if (future$state == "created") {
@@ -292,22 +297,19 @@ value.BatchtoolsFuture <- function(future, signal = TRUE,
292297

293298
stat <- status(future)
294299
if (is_na(stat)) {
295-
onMissing <- match.arg(onMissing)
296-
if (onMissing == "default") return(default)
297300
label <- future$label
298301
if (is.null(label)) label <- "<none>"
299-
stop(sprintf("The value no longer exists (or never existed) for Future ('%s') of class %s", label, paste(sQuote(class(future)), collapse = ", "))) #nolint
302+
stop(sprintf("The result no longer exists (or never existed) for Future ('%s') of class %s", label, paste(sQuote(class(future)), collapse = ", "))) #nolint
300303
}
301304

302305
result <- await(future, cleanup = FALSE)
303306
stop_if_not(inherits(result, "FutureResult"))
304307
future$result <- result
305308
future$state <- "finished"
306-
if (cleanup) delete(future, ...)
307-
308-
NextMethod("value")
309-
} # value()
309+
if (cleanup) delete(future)
310310

311+
NextMethod()
312+
}
311313

312314

313315
run <- function(...) UseMethod("run")
@@ -485,7 +487,7 @@ await.BatchtoolsFuture <- function(future, cleanup = TRUE,
485487
mdebug("- status(): %s", paste(sQuote(stat), collapse = ", "))
486488
mdebug("batchtools::waitForJobs() ... done")
487489

488-
finished <- is_na(stat) || any(c("done", "error", "expired") %in% stat)
490+
finished <- is_na(stat) || any(c("finished", "error", "expired") %in% stat)
489491

490492
## PROTOTYPE RESULTS BELOW:
491493
prototype_fields <- NULL
@@ -495,11 +497,13 @@ await.BatchtoolsFuture <- function(future, cleanup = TRUE,
495497
mdebug("Results:")
496498
label <- future$label
497499
if (is.null(label)) label <- "<none>"
498-
if ("done" %in% stat) {
500+
if ("finished" %in% stat) {
499501
result <- loadResult(reg = reg, id = jobid)
500502
if (inherits(result, "FutureResult")) {
501-
prototype_fields <- c(prototype_fields, "stdout")
502-
result$stdout <- getLog(id = jobid, reg = reg)
503+
prototype_fields <- c(prototype_fields, "batchtools_log")
504+
result[["batchtools_log"]] <- try({
505+
getLog(id = jobid, reg = reg)
506+
}, silent = TRUE)
503507
if (inherits(result$condition, "error")) {
504508
cleanup <- FALSE
505509
}
@@ -508,8 +512,7 @@ await.BatchtoolsFuture <- function(future, cleanup = TRUE,
508512
cleanup <- FALSE
509513
msg <- sprintf("BatchtoolsError in %s ('%s'): %s",
510514
class(future)[1], label, loggedError(future))
511-
stop(BatchtoolsFutureError(msg, future = future,
512-
output = loggedOutput(future)))
515+
stop(BatchtoolsFutureError(msg, future = future))
513516
} else if ("expired" %in% stat) {
514517
cleanup <- FALSE
515518
msg <- sprintf("BatchtoolsExpiration: Future ('%s') expired (registry path %s).", label, reg$file.dir)
@@ -524,7 +527,7 @@ await.BatchtoolsFuture <- function(future, cleanup = TRUE,
524527
} else {
525528
msg <- sprintf("%s. No logged output exist.", msg)
526529
}
527-
stop(BatchtoolsFutureError(msg, future = future, output = output))
530+
stop(BatchtoolsFutureError(msg, future = future))
528531
} else if (is_na(stat)) {
529532
msg <- sprintf("BatchtoolsDeleted: Cannot retrieve value. Future ('%s') deleted: %s", label, reg$file.dir) #nolint
530533
stop(BatchtoolsFutureError(msg, future = future))
@@ -621,13 +624,9 @@ delete.BatchtoolsFuture <- function(future,
621624
}
622625
}
623626

624-
## FIXME: Make sure to collect the results before deleting
627+
## Make sure to collect the results before deleting
625628
## the internal batchtools registry
626-
result <- future$result
627-
if (is.null(result)) {
628-
value(future, signal = FALSE)
629-
result <- future$result
630-
}
629+
result <- result(future, cleanup = FALSE)
631630
stop_if_not(inherits(result, "FutureResult"))
632631

633632
## To simplify post mortem troubleshooting in non-interactive sessions,

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,14 +191,14 @@ demo("mandelbrot", package = "future", ask = FALSE)
191191
## Installation
192192
R package future.batchtools is available on [CRAN](https://cran.r-project.org/package=future.batchtools) and can be installed in R as:
193193
```r
194-
install.packages('future.batchtools')
194+
install.packages("future.batchtools")
195195
```
196196
197197
### Pre-release version
198198
199199
To install the pre-release version that is available in Git branch `develop` on GitHub, use:
200200
```r
201-
source('http://callr.org/install#HenrikBengtsson/future.batchtools@develop')
201+
remotes::install_github("HenrikBengtsson/future.batchtools@develop")
202202
```
203203
This will install the package from source.
204204

appveyor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#----------------------------------------------------------------
66
environment:
77
_R_CHECK_FORCE_SUGGESTS_: false
8+
_R_CHECK_FULL_: true
89

910
matrix:
1011
- R_VERSION: devel

cran-comments.md

Lines changed: 37 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,64 @@
1-
# CRAN submission future.batchtools 0.7.0
1+
# CRAN submission future.batchtools 0.7.1
22

3-
on 2018-05-03
3+
on 2018-07-18
44

5-
This submission has been validated using 'R CMD check --as-cran' on Linux, Solaris, macOS, and Windows on the r-oldrel, r-release, and r-devel versions.
6-
7-
I've verified that this submission causes no issues for any of the 4 reverse (non-recursive) package dependencies available on CRAN.
5+
## Submission 1
86

97
Thanks in advance
108

9+
## Submission 2
1110

12-
### R CMD check --as-cran validation
11+
Resubmission of future.batchtools 0.7.1 where the overall R CMD check time has been decreased significantly.
1312

14-
The package has been verified using `R CMD check --as-cran` on:
1513

16-
* Platform x86_64-apple-darwin13.4.0 (64-bit) [Travis CI]:
17-
- R version 3.3.3 (2017-03-06)
14+
### R CMD check --as-cran validation
1815

19-
* Platform x86_64-apple-darwin15.6.0 (64-bit) [Travis CI]:
20-
# - R version 3.5.0 (2018-04-23) ## future 1.8.1 not available yet
16+
The package has been verified using `R CMD check --as-cran` on:
2117

2218
* Platform x86_64-apple-darwin15.6.0 (64-bit) [r-hub; single-core]:
23-
# - R version 3.5.0 (2018-04-23) ## data.table not available
19+
- R version 3.5.0 (2018-04-23)
2420

2521
* Platform x86_64-unknown-linux-gnu (64-bit) [Travis CI]:
26-
- R version 3.3.3 (2017-01-27)
22+
- R version 3.4.4 (2017-01-27)
2723
- R version 3.5.0 (2017-01-27)
28-
- R Under development (unstable) (2018-05-03 r74693)
24+
- R Under development (unstable) (2018-06-20 r74923)
2925

3026
* Platform x86_64-pc-linux-gnu (64-bit) [r-hub]:
3127
- R version 3.4.4 (2018-03-15)
32-
- R Under development (unstable) (2018-04-29 r74671)
28+
- R Under development (unstable) (2018-07-16 r74967)
3329

3430
* Platform x86_64-pc-linux-gnu (64-bit):
31+
- R version 3.2.0 (2015-04-16)
32+
- R version 3.3.0 (2016-05-03)
33+
- R version 3.4.0 (2017-04-21)
3534
- R version 3.5.0 (2018-04-23)
35+
- R version 3.5.1 (2018-07-02)
3636

37-
* Platform i686-pc-linux-gnu (32-bit):
38-
- R version 3.4.4 (2018-03-15)
39-
40-
* Platform i386-pc-solaris2.10 (32-bit) [r-hub]:
41-
- R version 3.5.0 Patched (2018-04-30 r74674)
37+
* Platform i386-w64-mingw32 (32-bit) (64-bit) [Appveyor CI]:
38+
- R Under development (unstable) (2018-07-16 r74967)
4239

43-
* Platform i386-w64-mingw32 (32-bit) [Appveyor CI]:
44-
- R Under development (unstable) (2018-05-02 r74682)
40+
* Platform x86_64-w64-mingw32/x64 (64-bit) [Appveyor CI]:
41+
- R version 3.5.1 (2018-07-02)
42+
- R Under development (unstable) (2018-07-16 r74967)
4543

4644
* Platform x86_64-w64-mingw32 (64-bit) [r-hub]:
47-
- R Under development (unstable) (2018-05-02 r74679)
48-
49-
* Platform x86_64-w64-mingw32/x64 (64-bit) [Appveyor CI]:
50-
- R version 3.5.0 (2018-04-23)
51-
- R Under development (unstable) (2018-05-02 r74682)
45+
- R Under development (unstable) (2018-07-16 r74967)
5246

5347
* Platform x86_64-w64-mingw32/x64 (64-bit) [win-builder]:
48+
- R version 3.5.1 (2018-07-02)
49+
- R Under development (unstable) (2018-07-16 r74967)
50+
51+
52+
The following setups were skipped due to non-availability:
53+
54+
* Platform x86_64-apple-darwin13.4.0 (64-bit) [Travis CI]:
55+
- R version 3.4.4 (2017-01-27)
56+
57+
* Platform x86_64-apple-darwin15.6.0 (64-bit) [Travis CI]:
5458
- R version 3.5.0 (2018-04-23)
55-
- R Under development (unstable) (2018-04-30 r74674)
59+
60+
* Platform i686-pc-linux-gnu (32-bit):
61+
- R version 3.4.4 (2018-03-15)
62+
63+
* Platform i686-pc-linux-gnu (32-bit):
64+
- R version 3.4.4 (2018-03-15)

man/status.BatchtoolsFuture.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)