Skip to content

Commit

Permalink
[SW-1006] Fix context path setting on RSparkling (#906)
Browse files Browse the repository at this point in the history
(cherry picked from commit 78f71b1)
  • Loading branch information
jakubhava committed Aug 16, 2018
1 parent 13d56f5 commit d990f1f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions r/src/R/h2o_context.R
Expand Up @@ -12,11 +12,16 @@ h2o_context.spark_connection <- function(x, strict_version_check = TRUE) {
hc <- invoke_static(x, "org.apache.spark.h2o.H2OContext", "getOrCreate", spark_context(x))
conf = invoke(hc, "getConf")
# Because of checks in Sparkling Water, we are sure context path starts with one slash
context_path_with_slash <- invoke(conf, "get", "spark.ext.h2o.context.path", NA_character_)
context_path_with_slash <- invoke(conf, "get", "spark.ext.h2o.context.path", "")
context_path <- substring(context_path_with_slash, 2, nchar(context_path_with_slash))
ip <- invoke(hc, "h2oLocalClientIp")
port <- invoke(hc, "h2oLocalClientPort")
invisible(capture.output(h2o.init(ip = ip, port = port, context_path = context_path, strict_version_check = strict_version_check, startH2O=F)))
if (context_path == "") {
invisible(capture.output(h2o.init(ip = ip, port = port, strict_version_check = strict_version_check, startH2O=F)))
} else {
invisible(capture.output(h2o.init(ip = ip, port = port, context_path = context_path, strict_version_check = strict_version_check, startH2O=F)))

}
hc
}

Expand Down

0 comments on commit d990f1f

Please sign in to comment.