|
1 | | -library(future.batchtools) |
2 | | -library(listenv) |
| 1 | +if (.Platform[["OS.type"]] != "windows") { |
| 2 | + library(future.batchtools) |
| 3 | + library(listenv) |
| 4 | + |
| 5 | + message("*** batchtools_ssh() ...") |
| 6 | + |
| 7 | + plan(batchtools_ssh, workers = 2L) |
| 8 | + supports_ssh <- tryCatch({ |
| 9 | + f <- future(42L) |
| 10 | + v <- value(f) |
| 11 | + identical(v, 42L) |
| 12 | + }, error = function(e) FALSE) |
| 13 | + message("Supports batchtools_ssh: ", supports_ssh) |
| 14 | + |
| 15 | + if (supports_ssh) { |
| 16 | + message("future(a) ...") |
| 17 | + a0 <- a <- 42 |
| 18 | + f <- future(a) |
| 19 | + stopifnot(identical(f$globals$a, a0)) |
| 20 | + v <- value(f) |
| 21 | + stopifnot(identical(v, a0)) |
| 22 | + |
| 23 | + message("future(a, lazy = TRUE) ...") |
| 24 | + a0 <- a <- 42 |
| 25 | + f <- future(a, lazy = TRUE) |
| 26 | + rm(list = "a") |
| 27 | + stopifnot(identical(f$globals$a, a0)) |
| 28 | + v <- value(f) |
| 29 | + stopifnot(identical(v, a0)) |
| 30 | + } ## if (supports_ssh) |
| 31 | + |
| 32 | + message("*** batchtools_ssh() ... DONE") |
| 33 | +} |
3 | 34 |
|
4 | | -message("*** batchtools_ssh() ...") |
5 | | - |
6 | | -plan(batchtools_ssh, workers = 2L) |
7 | | -supports_ssh <- tryCatch({ |
8 | | - f <- future(42L) |
9 | | - v <- value(f) |
10 | | - identical(v, 42L) |
11 | | -}, error = function(e) FALSE) |
12 | | -message("Supports batchtools_ssh: ", supports_ssh) |
13 | | - |
14 | | -if (supports_ssh) { |
15 | | - message("future(a) ...") |
16 | | - a0 <- a <- 42 |
17 | | - f <- future(a) |
18 | | - stopifnot(identical(f$globals$a, a0)) |
19 | | - v <- value(f) |
20 | | - stopifnot(identical(v, a0)) |
21 | | - |
22 | | - message("future(a, lazy = TRUE) ...") |
23 | | - a0 <- a <- 42 |
24 | | - f <- future(a, lazy = TRUE) |
25 | | - rm(list = "a") |
26 | | - stopifnot(identical(f$globals$a, a0)) |
27 | | - v <- value(f) |
28 | | - stopifnot(identical(v, a0)) |
29 | | -} ## if (supports_ssh) |
30 | | - |
31 | | -message("*** batchtools_ssh() ... DONE") |
32 | 35 |
|
0 commit comments