Skip to content

Commit

Permalink
Merge pull request h2oai#499 from h2oai/JG_PUBDEV-3534_custom-jar-path
Browse files Browse the repository at this point in the history
allow to use arbitrary h2o.jar, closes PUBDEV-3534
  • Loading branch information
jangorecki authored Nov 18, 2016
2 parents a549a0e + fe01c74 commit bedc3e8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
8 changes: 8 additions & 0 deletions h2o-py/h2o/backend/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,14 @@ def _find_jar(self, path0=None):
@staticmethod
def _jar_paths():
"""Produce potential paths for an h2o.jar executable."""

# PUBDEV-3534 hook to use arbitrary h2o.jar
own_jar = os.getenv("H2O_JAR_PATH", "")
if own_jar != "":
if not os.path.isfile(own_jar):
raise H2OStartupError("Environment variable H2O_JAR_PATH is set to '%d' but file does not exists, unset environment variable or provide valid path to h2o.jar file." % own_jar)
yield own_jar

# Check if running from an h2o-3 src folder (or any subfolder), in which case use the freshly-built h2o.jar
cwd_chunks = os.path.abspath(".").split(os.path.sep)
for i in range(len(cwd_chunks), 0, -1):
Expand Down
9 changes: 8 additions & 1 deletion h2o-r/h2o-package/R/connection.R
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,14 @@ h2o.clusterStatus <- function() {
# It will download a jar file if it needs to.
.h2o.downloadJar <- function(overwrite = FALSE) {
if(!is.logical(overwrite) || length(overwrite) != 1L || is.na(overwrite)) stop("`overwrite` must be TRUE or FALSE")


# PUBDEV-3534 hook to use arbitrary h2o.jar
own_jar = Sys.getenv("H2O_JAR_PATH")
if (nzchar(own_jar)) {
if (!file.exists(own_jar)) stop(sprintf("Environment variable H2O_JAR_PATH is set to '%s' but file does not exists, unset environment variable or provide valid path to h2o.jar file.", own_jar))
return(own_jar)
}

if (is.null(.h2o.pkg.path)) {
pkg_path = dirname(system.file(".", package = "h2o"))
} else {
Expand Down

0 comments on commit bedc3e8

Please sign in to comment.