Skip to content

Cannot find symbols exported to node by parallel::clusterExport #339

@renkun-ken

Description

@renkun-ken

In the following example, I try to export certain variables to each cluster node before any future is created. However, the exported symbols cannot be found when a future is resolved.

I don't want future() to detect globals or export variables because in my use case, there are tens of futures and they will be called periodically (every several minutes), each run is time critical so that I don't want the same global variables to be detected and exported to the workers again and again.

library(future)
library(parallel)

test1 <- rnorm(10000)

cl <- makeClusterPSOCK(2)
clusterExport(cl, "test1")
plan(cluster, workers = cl)

f <- future({
  sum(test1)
}, globals = FALSE)
values(f)
stopCluster(cl)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions