|
103 | 103 | ## recursive loop caused by other plan() calls. |
104 | 104 | attr(evaluator, "init") <- "done" |
105 | 105 |
|
106 | | - ## Create dummy future to trigger setup (minimum overhead) |
107 | | - f <- evaluator(NA, label = "future-plan-test", |
108 | | - globals = FALSE, lazy = FALSE) |
109 | | - |
110 | | - ## Cleanup, by resolving it |
111 | | - ## (otherwise the garbage collector would have to do it) |
112 | | - res <- tryCatch({ |
113 | | - value(f) |
114 | | - }, FutureError = identity) |
115 | | - if (inherits(res, "FutureError")) { |
116 | | - res[["message"]] <- paste0( |
117 | | - "Initialization of plan() failed, because the test future used for validation failed. The reason was: ", conditionMessage(res)) |
118 | | - stop(res) |
119 | | - } |
120 | | - |
121 | | - if (!identical(res, NA)) { |
122 | | - res <- if (is.null(res)) { |
123 | | - "NULL" |
124 | | - } else { |
125 | | - commaq(res) |
| 106 | + ## Non-FutureBackend backends are initiated by calling the evaluator |
| 107 | + if (is.null(attr(evaluator, "backend"))) { |
| 108 | + ## Create dummy future to trigger setup (minimum overhead) |
| 109 | + f <- evaluator(NA, label = "future-plan-test", |
| 110 | + globals = FALSE, lazy = FALSE) |
| 111 | + |
| 112 | + ## Cleanup, by resolving it |
| 113 | + ## (otherwise the garbage collector would have to do it) |
| 114 | + res <- tryCatch({ |
| 115 | + value(f) |
| 116 | + }, FutureError = identity) |
| 117 | + if (inherits(res, "FutureError")) { |
| 118 | + res[["message"]] <- paste0( |
| 119 | + "Initialization of plan() failed, because the test future used for validation failed. The reason was: ", conditionMessage(res)) |
| 120 | + stop(res) |
| 121 | + } |
| 122 | + |
| 123 | + if (!identical(res, NA)) { |
| 124 | + res <- if (is.null(res)) { |
| 125 | + "NULL" |
| 126 | + } else { |
| 127 | + commaq(res) |
| 128 | + } |
| 129 | + stop(FutureError(sprintf("Initialization of plan() failed, because the value of the test future is not NA as expected: %s", res))) |
126 | 130 | } |
127 | | - stop(FutureError(sprintf("Initialization of plan() failed, because the value of the test future is not NA as expected: %s", res))) |
128 | 131 | } |
129 | 132 |
|
130 | 133 | if (debug) { |
|
0 commit comments