gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 10:49:42 25 4
gpt4 key购买 nike

我正在运行以下代码来连接到 R 中的 H2O 并获得以下输出: h2o.init(nthreads=-1, max_mem_size = Paste(x,"g", sep = ""))

R is connected to the H2O cluster: 
H2O cluster uptime: 3 minutes 57 seconds
H2O cluster version: 3.14.0.3
H2O cluster version age: 3 days
H2O cluster name: H2O_started_from_R_rami_krispin
H2O cluster total nodes: 1
H2O cluster total memory: 0.88 GB
H2O cluster total cores: 4
H2O cluster allowed cores: 4
H2O cluster healthy: TRUE
H2O Connection ip: localhost
H2O Connection port: 54321
H2O Connection proxy: NA
H2O Internal Security: FALSE
H2O API Extensions: Algos, AutoML, Core V3, Core V4
R Version: R version 3.4.1 (2017-06-30)

是否有一种方法可以将连接成功的情况(例如 is.h2o.connect() 响应为 True/False)以及连接到变量的属性捕获到 bool 变量中?例如:

x$port
>54321

x$memory
>0.88 GB

提前谢谢您!拉米

最佳答案

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

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

关于r - 如何在R中测试r中与H2O的连接是否成功,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46417508/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com