Skip to content

Commit 71a2522

Browse files
Printing a batchtools future will show logged output
Author: Henrik Bengtsson <[email protected]>
1 parent 714cf6c commit 71a2522

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
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-9970
2+
Version: 0.12.2-9971
33
Depends:
44
R (>= 3.2.0),
55
parallelly,

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535

3636
* Calling `plan()` on `batchtools_sge` and `batchtools_slurm` reports
3737
on the version of the scheduler.
38+
39+
* Printing a batchtools future will show logged output.
3840

3941
## Documentation
4042

R/BatchtoolsFutureBackend-class.R

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,8 +449,17 @@ print.BatchtoolsFuture <- function(x, ...) {
449449
## Ask for status once
450450
status <- status(x)
451451
printf("batchtools status: %s\n", paste(sQuote(status), collapse = ", "))
452-
if ("error" %in% status) {
453-
printf("Error captured by batchtools: %s\n", loggedError(x))
452+
if (any(c("finished", "error", "expired") %in% status)) {
453+
if ("error" %in% status) {
454+
lines <- loggedError(x)
455+
lines <- sprintf("[error] %s", lines)
456+
lines <- paste(lines, collapse = "\n")
457+
printf("Error captured by batchtools:\n%s\n", lines)
458+
}
459+
lines <- loggedOutput(x)
460+
lines <- sprintf("[output] %s", lines)
461+
lines <- paste(lines, collapse = "\n")
462+
printf("Output captured by batchtools:\n%s\n", lines)
454463
}
455464

456465
if (is_na(status)) {

0 commit comments

Comments
 (0)