如何测试r中与H2O的连接在r中是否成功

如何测试r中与H2O的连接在r中是否成功,r,h2o,R,H2o,我正在运行以下代码以连接到R中的H2O并获得以下输出: h2o.init(n读数=-1,最大内存大小=粘贴(x,“g”,sep=”“) 有没有一种方法可以将连接成功的内容(比如响应为True/False的Is.h2o.connect())和连接的属性捕获到布尔变量中?例如: x$port >54321 或 提前谢谢你! Rami查看集群是否已启动,您可以使用 h2o.clusterIsUp() # TRUE h2o.getConnection() IP Address: localh

我正在运行以下代码以连接到R中的H2O并获得以下输出: h2o.init(n读数=-1,最大内存大小=粘贴(x,“g”,sep=”“)

有没有一种方法可以将连接成功的内容(比如响应为True/False的
Is.h2o.connect()
)和连接的属性捕获到布尔变量中?例如:

x$port
>54321

提前谢谢你!
Rami

查看集群是否已启动,您可以使用

h2o.clusterIsUp()
# TRUE
h2o.getConnection()

IP Address: localhost 
Port      : 54321 
Session ID: _sid_b51e 
Key Count : 0
并查看您可以使用的连接信息

h2o.clusterIsUp()
# TRUE
h2o.getConnection()

IP Address: localhost 
Port      : 54321 
Session ID: _sid_b51e 
Key Count : 0
然后,您可以使用一些内部
h2o
函数来获取有关连接的所有元数据

res <- h2o:::.h2o.fromJSON(
         jsonlite::fromJSON(
           h2o:::.h2o.doSafeGET(
             urlSuffix = h2o:::.h2o.__CLOUD
           ), 
           implifyDataFrame = FALSE
         )
       )

str(res)
List of 19
 $ __meta                   :List of 3
  ..$ schema_version: int 3
  ..$ schema_name   : chr "CloudV3"
  ..$ schema_type   : chr "Iced"
 $ _exclude_fields          : chr ""
 $ skip_ticks               : logi TRUE
 $ version                  : chr "3.10.4.6"
 $ branch_name              : chr "rel-ueno"
 $ build_number             : chr "6"
 $ build_age                : chr "4 months and 30 days"
 $ build_too_old            : logi TRUE
 $ node_idx                 : int 0
 $ cloud_name               : chr "H2O_started_from_R_david_tos519"
 $ cloud_size               : int 1
 $ cloud_uptime_millis      : int 772951
 $ cloud_healthy            : logi TRUE
 $ bad_nodes                : int 0
 $ consensus                : logi TRUE
 $ locked                   : logi TRUE
 $ is_client                : logi FALSE
 $ nodes                    :List of 1
  ..$ :List of 27
  .. ..$ __meta        :List of 3
  .. .. ..$ schema_version: int 3
  .. .. ..$ schema_name   : chr "NodeV3"
  .. .. ..$ schema_type   : chr "Iced"
... etc

resOK,
h2o.clusterStatus()
正在提供连接属性

                           h2o healthy    last_ping
1 localhost/127.0.0.1:54321    TRUE 1.506398e+12
  num_cpus  sys_load mem_value_size  free_mem
1        4 0.2445616           5120 783876096
   pojo_mem swap_mem    free_disk     max_disk
1 170846208        0 310012542976 510426873856
   pid num_keys tcps_active open_fds rpcs_active
1 7084       20           0       -1           0

第一个问题是
h2o.clustrisup()
你想要什么?太快了!是的!谢谢然后
h2o.clusterInfo()
将向您提供打印到控制台的信息。我认为,要将其放入R对象,您需要一种捕获和解析它的方法