增加h2o.init超时 [英] Increase h2o.init timeout

查看:92
本文介绍了增加h2o.init超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过R启动h2o服务器时,如何增加h2o启动超时? 我有一个多节点AWS EC2集群,在其中每个节点上启动一个单独的h2o服务器.启动后,某些EC2节点可能会变慢,我宁愿增加超时时间,也不愿在这些节点上重新运行h2o初始化代码.

How can I increase the h2o startup timeout when starting an h2o server via R? I have a multinode AWS EC2 cluster, where I start a separate h2o server on each node. After startup, some EC2 nodes can be a bit slow and I'd rather increase the timeout than to re-run the h2o initialization code on these nodes.

我目前正在做的是

library(doParallel)
library(foreach)

workers=parallel::makePSOCKcluster(workerIPs,master=masterIP)
registerDoParallel(workers)

foreach(i=seq_along(workers),.inorder=FALSE,.multicombine=TRUE) %dopar% {
  library(h2o)
  h2o.init(nthreads=-1)
  paste0(capture.output(h2o.clusterStatus()),collapse="\n")
}

如果h2o.init(nthreads=-1)产生超时,则慢速节点将在h2o.clusterStatus()处引发错误.

Slow nodes will throw an error at h2o.clusterStatus() if h2o.init(nthreads=-1) produced a timeout.

顺便说一句:我正在使用h2o v 3.10.4.4,并且正在使用Ubuntu 16.04.

BTW: I am using h2o v 3.10.4.4 and I am on ubuntu 16.04.

推荐答案

因此,我查看了github上的h2o源代码,似乎没有一个timeout参数(在R中都没有)也不在基础java代码中).有一个名为session_timeoutjava自变量,但我认为这不适用于我的问题.

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.

所以我要做的是

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.

这篇关于增加h2o.init超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆