Skip to content

Commit

Permalink
When using value() internally for collection the results, use stdout …
Browse files Browse the repository at this point in the history
…= FALSE to avoid spurious outputs. When all backends moved to implementing result(), we'll use that instead of value()
  • Loading branch information
HenrikBengtsson committed Jul 8, 2018
1 parent a40ef8a commit 2e46435
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion R/ClusterFuture-class.R
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ resolved.ClusterFuture <- function(x, timeout = 0.2, ...) {
} else {
## stop("Not yet implemented: ", paste(sQuote(class(node)), collapse = ", "))
warning(sprintf("resolved() is not yet implemented for workers of class %s. Will use value() instead and return TRUE", sQuote(class(node)[1])))
value(x, signal = FALSE)
value(x, stdout = FALSE, signal = FALSE)
res <- TRUE
}

Expand Down
2 changes: 1 addition & 1 deletion R/Future-class.R
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ result.Future <- function(future, ...) {
## BACKWARD COMPATIBILITY:
## For now, it is value() that collects the results. Later we want
## all future backends to use result() to do it. /HB 2018-02-22
value(future, signal = FALSE)
value(future, stdout = FALSE, signal = FALSE)
}

result <- future$result
Expand Down
2 changes: 1 addition & 1 deletion R/FutureRegistry.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ FutureRegistry <- local({
## This, this may result in a call to
## FutureRegistry(..., action = "remove").
tryCatch({
value(future, signal = FALSE)
value(future, stdout = FALSE, signal = FALSE)
}, FutureError = function(ex) {
mdebug(sprintf("Detected a %s while FutureRegistry collecting results: %s",
class(ex)[1], paste(capture.output(print(ex)), collapse = "\n")))
Expand Down
2 changes: 2 additions & 0 deletions R/stdout_OP.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#' @param fassignment The future assignment, e.g.
#' \code{x \%<-\% \{ expr \}}.
#'
#' @param capture If TRUE, the standard output will be captured, otherwise not.
#'
#' @export
`%stdout%` <- function(fassignment, capture) {
fassignment <- substitute(fassignment)
Expand Down
2 changes: 2 additions & 0 deletions man/grapes-stdout-grapes.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2e46435

Please sign in to comment.