aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Chu <chu11@llnl.gov>2014-08-01 19:00:38 -0700
committerMatei Zaharia <matei@databricks.com>2014-08-01 19:00:46 -0700
commit0da07da53e5466ec44c8050020cbc4b9957cb949 (patch)
tree62fe025a279c7f7a9eedd0504fd7941282d7b4a8
parent3822f33f3ce1428703a4796d7a119b40a6b32259 (diff)
downloadspark-0da07da53e5466ec44c8050020cbc4b9957cb949.tar.gz
spark-0da07da53e5466ec44c8050020cbc4b9957cb949.tar.bz2
spark-0da07da53e5466ec44c8050020cbc4b9957cb949.zip
[SPARK-2116] Load spark-defaults.conf from SPARK_CONF_DIR if set
If SPARK_CONF_DIR environment variable is set, search it for spark-defaults.conf. Author: Albert Chu <chu11@llnl.gov> Closes #1059 from chu11/SPARK-2116 and squashes the following commits: 9f3ac94 [Albert Chu] SPARK-2116: If SPARK_CONF_DIR environment variable is set, search it for spark-defaults.conf.
-rw-r--r--core/src/main/scala/org/apache/spark/deploy/SparkSubmitArguments.scala11
1 files changed, 11 insertions, 0 deletions
diff --git a/core/src/main/scala/org/apache/spark/deploy/SparkSubmitArguments.scala b/core/src/main/scala/org/apache/spark/deploy/SparkSubmitArguments.scala
index dd044e6298..9391f24e71 100644
--- a/core/src/main/scala/org/apache/spark/deploy/SparkSubmitArguments.scala
+++ b/core/src/main/scala/org/apache/spark/deploy/SparkSubmitArguments.scala
@@ -86,6 +86,17 @@ private[spark] class SparkSubmitArguments(args: Seq[String]) {
private def mergeSparkProperties(): Unit = {
// Use common defaults file, if not specified by user
if (propertiesFile == null) {
+ sys.env.get("SPARK_CONF_DIR").foreach { sparkConfDir =>
+ val sep = File.separator
+ val defaultPath = s"${sparkConfDir}${sep}spark-defaults.conf"
+ val file = new File(defaultPath)
+ if (file.exists()) {
+ propertiesFile = file.getAbsolutePath
+ }
+ }
+ }
+
+ if (propertiesFile == null) {
sys.env.get("SPARK_HOME").foreach { sparkHome =>
val sep = File.separator
val defaultPath = s"${sparkHome}${sep}conf${sep}spark-defaults.conf"