File: batchtools_ssh.R

package info (click to toggle)
r-cran-future.batchtools 0.12.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 528 kB
  • sloc: sh: 82; makefile: 2
file content (33 lines) | stat: -rw-r--r-- 722 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
source("incl/start.R")
library("listenv")

message("*** batchtools_ssh() ...")

plan(batchtools_ssh, workers = 2L)
supports_ssh <- tryCatch({
  f <- future(42L)
  v <- value(f)
  identical(v, 42L)
}, error = function(e) FALSE)
message("Supports batchtools_ssh: ", supports_ssh)

if (supports_ssh) {
  message("future(a) ...")
  a0 <- a <- 42
  f <- future(a)
  stopifnot(identical(f$globals$a, a0))
  v <- value(f)
  stopifnot(identical(v, a0))

  message("future(a, lazy = TRUE) ...")
  a0 <- a <- 42
  f <- future(a, lazy = TRUE)
  rm(list = "a")
  stopifnot(identical(f$globals$a, a0))
  v <- value(f)
  stopifnot(identical(v, a0))
} ## if (supports_ssh)

message("*** batchtools_ssh() ... DONE")

source("incl/end.R")