R: set 'Checkpoint' on Worker of Cluster

送分小仙女□ 提交于 2019-12-23 16:48:07

问题


I use the following code to ...
1. create a parallel cluster
2. source test.R
3. and do some parallel work with functions defined in 'test.R'

library(parallel)
cl <- makeCluster(4)
clusterEvalQ(cl, source("test.R"))

  ## do some parallel work

stopCluster(cl)

Unfortunately I rely on old packages :-(
One can make use of past snapshots of the CRAN packages using 'checkpoints'

require(checkpoint)
checkpoint("2015-02-28")

My question is ...
how can I make use of the old packages on the Cluster workers?
The following does not work:

library(parallel)
cl <- makeCluster(4)
  clusterEvalQ(cl, require(checkpoint))        # 1. load checkpoint package on workers
  clusterEvalQ(cl, checkpoint("2015-02-28"))   # 2. set the checkponit on workers
clusterEvalQ(cl, source("test.R"))

  ## do some parallel work

stopCluster(cl)

The command

clusterEvalQ(cl, require(checkpoint))

Returns TRUE. But the second

clusterEvalQ(cl, checkpoint("2015-02-28"))

just hangs. I don't know why the workers hang on that command. Can I somehow look into the worker to see if they are maybe just waiting for user Input or so?

来源:https://stackoverflow.com/questions/37028653/r-set-checkpoint-on-worker-of-cluster

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!