tests/globals,nested.R

## This requires mirai (>= 0.13.2)
if (packageVersion("mirai") >= "0.13.2") {
library(future.mirai)

mirai::daemons(1, dispatcher = FALSE)
plan(mirai_cluster)

g <- function() 42
h <- function() g()

f <- future(h())
v <- value(f)
print(v)
stopifnot(v == h())

plan(sequential)
mirai::daemons(0)  ## Reset any daemons running
gc()

}

Try the future.mirai package in your browser

Any scripts or data that you put into this service are public.

future.mirai documentation built on July 3, 2024, 5:06 p.m.