Skip to content

Commit

Permalink
GH-16360: Fix R package for Windows (#16369)
Browse files Browse the repository at this point in the history
* Fix R package for Windows

* Fix pyunit_cluster test
  • Loading branch information
tomasfryda authored Sep 18, 2024
1 parent 5deeb84 commit d2023b1
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion h2o-core/src/main/java/water/api/CloudHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public CloudV3 status(int version, CloudV3 cloud) {
cloud.consensus = Paxos._commonKnowledge;
cloud.locked = Paxos._cloudLocked;
cloud.internal_security_enabled = H2OSecurityManager.instance().securityEnabled;

cloud.web_ip = H2O.ARGS.web_ip;

// set leader
H2ONode leader = H2O.CLOUD.leaderOrNull(); // leader might be null in client mode if clouding didn't finish yet
Expand Down
3 changes: 3 additions & 0 deletions h2o-core/src/main/java/water/api/schemas3/CloudV3.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ public CloudV3() {}
@API(help="leader_idx", direction=API.Direction.OUTPUT)
public int leader_idx = -1;

@API(help="web_ip", direction=API.Direction.OUTPUT)
public String web_ip=null;

// Output fields one-per-JVM
public static class NodeV3 extends SchemaV3<Iced, NodeV3> {
public NodeV3() {}
Expand Down
4 changes: 2 additions & 2 deletions h2o-py/tests/testdir_misc/pyunit_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ def test_cluster_status():

def test_cluster_properties():
cl = h2o.cluster()
assert len(cl._schema_attrs_) == 24
assert len(cl._schema_attrs_) == 25
for k in cl._schema_attrs_.keys():
assert getattr(cl, k) is not None
assert getattr(cl, k) is not None or k == "web_ip"


def test_exception_on_unknown_cluster_property():
Expand Down
5 changes: 5 additions & 0 deletions h2o-r/h2o-package/R/communication.R
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,11 @@ h2o.clusterInfo <- function() {
if (res$build_too_old) {
warning(sprintf("\nYour H2O cluster version is (%s) old. There may be a newer version available.\nPlease download and install the latest version from: https://h2o-release.s3.amazonaws.com/h2o/latest_stable.html", res$build_age))
}

if (is.null(res$web_ip)){
warning("SECURITY_WARNING: web_ip is not specified. H2O Rest API is listening on all available interfaces.")
}

}

.h2o.translateJobType <- function(type) {
Expand Down
11 changes: 0 additions & 11 deletions h2o-r/h2o-package/R/connection.R
Original file line number Diff line number Diff line change
Expand Up @@ -237,17 +237,6 @@ h2o.init <- function(ip = "localhost", port = 54321, name = NA_character_, start

stop("H2O failed to start, stopping execution.")
}

securityWarnings <- ""
if (file.info(stdout)$size > 0) {
securityWarnings <- grep("SECURITY_WARNING", readLines(stdout), value=TRUE)
}
if (length(securityWarnings) > 0) {
msg = paste(
"Server process startup raise a security warning:",
paste(securityWarnings, collapse = "\n"), sep = "\n")
warning(msg)
}
} else
stop("Can only start H2O launcher if IP address is localhost.")
}
Expand Down

0 comments on commit d2023b1

Please sign in to comment.