diff options
author | WangTaoTheTonic <wangtao111@huawei.com> | 2015-05-03 00:47:47 +0100 |
---|---|---|
committer | Sean Owen <sowen@cloudera.com> | 2015-05-03 00:47:47 +0100 |
commit | 49549d5a1a867c3ba25f5e4aec351d4102444bc0 (patch) | |
tree | 05d5cc672fa6cafb69e6e25695c53635f25517b7 /launcher | |
parent | ea841efc5a67e9a64a4ec803d31e4023b565c327 (diff) | |
download | spark-49549d5a1a867c3ba25f5e4aec351d4102444bc0.tar.gz spark-49549d5a1a867c3ba25f5e4aec351d4102444bc0.tar.bz2 spark-49549d5a1a867c3ba25f5e4aec351d4102444bc0.zip |
[SPARK-7031] [THRIFTSERVER] let thrift server take SPARK_DAEMON_MEMORY and SPARK_DAEMON_JAVA_OPTS
We should let Thrift Server take these two parameters as it is a daemon. And it is better to read driver-related configs as an app submited by spark-submit.
https://issues.apache.org/jira/browse/SPARK-7031
Author: WangTaoTheTonic <wangtao111@huawei.com>
Closes #5609 from WangTaoTheTonic/SPARK-7031 and squashes the following commits:
8d3fc16 [WangTaoTheTonic] indent
035069b [WangTaoTheTonic] better code style
d3ddfb6 [WangTaoTheTonic] revert the unnecessary changes in suite
624e652 [WangTaoTheTonic] fix break tests
0565831 [WangTaoTheTonic] fix failed tests
4fb25ed [WangTaoTheTonic] let thrift server take SPARK_DAEMON_MEMORY and SPARK_DAEMON_JAVA_OPTS
Diffstat (limited to 'launcher')
-rw-r--r-- | launcher/src/main/java/org/apache/spark/launcher/SparkSubmitCommandBuilder.java | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/launcher/src/main/java/org/apache/spark/launcher/SparkSubmitCommandBuilder.java b/launcher/src/main/java/org/apache/spark/launcher/SparkSubmitCommandBuilder.java index a73c9c87e3..7d387d406e 100644 --- a/launcher/src/main/java/org/apache/spark/launcher/SparkSubmitCommandBuilder.java +++ b/launcher/src/main/java/org/apache/spark/launcher/SparkSubmitCommandBuilder.java @@ -190,6 +190,10 @@ class SparkSubmitCommandBuilder extends AbstractCommandBuilder { firstNonEmptyValue(SparkLauncher.DRIVER_EXTRA_CLASSPATH, conf, props) : null; List<String> cmd = buildJavaCommand(extraClassPath); + // Take Thrift Server as daemon + if (isThriftServer(mainClass)) { + addOptionString(cmd, System.getenv("SPARK_DAEMON_JAVA_OPTS")); + } addOptionString(cmd, System.getenv("SPARK_SUBMIT_OPTS")); addOptionString(cmd, System.getenv("SPARK_JAVA_OPTS")); @@ -201,7 +205,11 @@ class SparkSubmitCommandBuilder extends AbstractCommandBuilder { // - SPARK_DRIVER_MEMORY env variable // - SPARK_MEM env variable // - default value (512m) - String memory = firstNonEmpty(firstNonEmptyValue(SparkLauncher.DRIVER_MEMORY, conf, props), + // Take Thrift Server as daemon + String tsMemory = + isThriftServer(mainClass) ? System.getenv("SPARK_DAEMON_MEMORY") : null; + String memory = firstNonEmpty(tsMemory, + firstNonEmptyValue(SparkLauncher.DRIVER_MEMORY, conf, props), System.getenv("SPARK_DRIVER_MEMORY"), System.getenv("SPARK_MEM"), DEFAULT_MEM); cmd.add("-Xms" + memory); cmd.add("-Xmx" + memory); @@ -292,6 +300,15 @@ class SparkSubmitCommandBuilder extends AbstractCommandBuilder { (!userMaster.equals("yarn-cluster") && deployMode == null); } + /** + * Return whether the given main class represents a thrift server. + */ + private boolean isThriftServer(String mainClass) { + return (mainClass != null && + mainClass.equals("org.apache.spark.sql.hive.thriftserver.HiveThriftServer2")); + } + + private class OptionParser extends SparkSubmitOptionParser { @Override |