Increase h2o.init timeout

给你一囗甜甜゛ 提交于 2019-12-08 04:13:22

So, I looked at the h2o source code on github and it does not seem as if there is a timeout argument (neither in R nor in the underlying java code). There is a java argument called session_timeout but I don't think this applies to my problem.

So what I did is this:

foreach(i=seq_along(workers),.inorder=FALSE,.multicombine=TRUE) %dopar% {
  library(h2o)
  startCounter=1
  startCounterMax=3
  while(inherits(clusterStatus<-try({
      h2o.init(nthreads=-1)
      capture.output(h2o.clusterStatus())
    },silent=TRUE),"try-error")&(startCounter<=startCounterMax)) {
    startCounter=startCounter+1
  }
  if (startCounter>startCounterMax) stop("Failed to start h2o server for ",
                                         startCounterMax," successive times")

  return(clusterStatus)
}

Not very nice but it does the job.

If you are trying to form a cluster of several H2O nodes (say cluster of 3 h2o nodes with one node per machine) and you want to wait for a specified time then you can try it in Java code - water.H2O.waitForCloudSize(3, 50 * 1000/*ms*/); I assume there should be the corresponding parameter available in R as well.

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