|
3 | 3 | #' @param x A \link{Future}, a list, or an environment (which also |
4 | 4 | #' includes \link[listenv:listenv]{list environment}). |
5 | 5 | #' |
6 | | -#' @param run (logical) If TRUE, any lazy futures is launched, |
7 | | -#' otherwise not. |
8 | | -#' |
9 | 6 | #' @param \ldots Not used. |
10 | 7 | #' |
11 | 8 | #' @return |
|
15 | 12 | #' It never signals an error. |
16 | 13 | #' |
17 | 14 | #' @details |
18 | | -#' `resolved(..., run = TRUE)` attempts to launch a lazy future, if there is |
19 | | -#' an available worker, otherwise not. |
| 15 | +#' `resolved()` attempts to launch a lazy future, if there is an available |
| 16 | +#' worker, otherwise not. |
20 | 17 | #' |
21 | 18 | #' `resolved()` methods must always return `TRUE` or `FALSE` values, must |
22 | | -#' always launch lazy futures by default (`run = TRUE`), and must never block |
23 | | -#' indefinitely. This is because it should always be possible to poll futures |
24 | | -#' until they are resolved using `resolved()`, e.g. |
| 19 | +#' always launch lazy futures, and must never block indefinitely. This is |
| 20 | +#' because it should always be possible to poll futures until they are |
| 21 | +#' resolved using `resolved()`, e.g. |
25 | 22 | #' `while (!all(resolved(futures))) Sys.sleep(5)`. |
26 | 23 | #' |
27 | 24 | #' Each future backend must implement a `resolved()` method. It should return |
@@ -122,19 +119,26 @@ resolved.environment <- function(x, ...) { |
122 | 119 |
|
123 | 120 | #' @rdname resolved |
124 | 121 | #' @export |
125 | | -resolved.Future <- function(x, run = TRUE, ...) { |
| 122 | +resolved.Future <- function(x, ...) { |
126 | 123 | future <- x |
| 124 | + args <- list(...) |
| 125 | + run <- args[["run"]] |
| 126 | + |
127 | 127 | debug <- isTRUE(getOption("future.debug")) |
128 | 128 | if (debug) { |
129 | 129 | mdebugf_push("resolved() for %s (%s) ...", class(future)[1], sQuoteLabel(future)) |
130 | 130 | on.exit(mdebug_pop()) |
131 | 131 | mdebug("state: ", sQuote(future[["state"]])) |
132 | | - mdebug("run: ", run) |
| 132 | + mdebug("run: ", deparse(run)) |
133 | 133 | } |
134 | | - |
| 134 | + |
| 135 | + if (!is.null(run)) { |
| 136 | + deprecateArgument("resolved", "run", run) |
| 137 | + } |
| 138 | + |
135 | 139 | ## A lazy future not even launched? |
136 | 140 | if (future[["state"]] == "created") { |
137 | | - if (!run) return(FALSE) |
| 141 | + if (isFALSE(run)) return(FALSE) |
138 | 142 | if (debug) mdebug_push("run() ...") |
139 | 143 | future <- run(future) |
140 | 144 | if (debug) { |
|
0 commit comments