Skip to content

Commit 77bf672

Browse files
committed
Add -extraJavaOpts option to the Hadoop H2O Driver.
This will allow passing "-extraJavaOpts -XX:MaxDirectMemorySize=512m" for example.
1 parent e054707 commit 77bf672

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

hadoop/src/main/java/water/hadoop/h2odriver.java

+7
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public class h2odriver extends Configured implements Tool {
6161
static boolean enableSuspend = false;
6262
static int debugPort = 5005; // 5005 is the default from IDEA
6363
static String licenseFileName = null;
64+
static String extraJavaOpts = null;
6465

6566
// State filled in as a result of handling options.
6667
static String licenseData = null;
@@ -392,6 +393,7 @@ static void usage() {
392393
" [-verbose:gc]\n" +
393394
" [-XX:+PrintGCDetails]\n" +
394395
" [-license <license file name (local filesystem, not hdfs)>]\n" +
396+
" [-extraJavaOpts <extra Java options (e.g., -XX:MaxDirectMemorySize=128m)>]\n" +
395397
" -o | -output <hdfs output dir>\n" +
396398
"\n" +
397399
"Notes:\n" +
@@ -600,6 +602,10 @@ else if (s.equals("-license")) {
600602
i++; if (i >= args.length) { usage(); }
601603
licenseFileName = args[i];
602604
}
605+
else if (s.equals("-extraJavaOpts")) {
606+
i++; if (i >= args.length) { usage(); }
607+
extraJavaOpts = args[i];
608+
}
603609
else {
604610
error("Unrecognized option " + s);
605611
}
@@ -856,6 +862,7 @@ private int run2(String[] args) throws Exception {
856862
+ (enableExcludeMethods ? " -XX:CompileCommand=exclude,water/fvec/NewChunk.append2slowd" : "")
857863
+ (enableLog4jDefaultInitOverride ? " -Dlog4j.defaultInitOverride=true" : "")
858864
+ (enableDebug ? " -agentlib:jdwp=transport=dt_socket,server=y,suspend=" + (enableSuspend ? "y" : "n") + ",address=" + debugPort : "")
865+
+ (extraJavaOpts != null ? (" " + extraJavaOpts) : "")
859866
;
860867
conf.set("mapred.child.java.opts", mapChildJavaOpts);
861868
conf.set("mapred.map.child.java.opts", mapChildJavaOpts); // MapR 2.x requires this.

0 commit comments

Comments
 (0)