Skip to content

Commit ac2d65e

Browse files
committed
Change spark.local.dir -> SPARK_LOCAL_DIRS
1 parent 4bc07ee commit ac2d65e

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

conf/spark-env.sh.template

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#
66
# The following variables can be set in this file:
77
# - SPARK_LOCAL_IP, to set the IP address Spark binds to on this node
8+
# - SPARK_PUBLIC_DNS, to set the public dns name of the driver program
9+
# - SPARK_LOCAL_DIRS, shuffle directories to use on this node
810
# - MESOS_NATIVE_LIBRARY, to point to your libmesos.so if you use Mesos
911
# - SPARK_JAVA_OPTS, to set node-specific JVM options for Spark. Note that
1012
# we recommend setting app-wide options in the application's driver program.

core/src/main/scala/org/apache/spark/SparkConf.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,15 @@ class SparkConf(loadDefaults: Boolean) extends Cloneable with Logging {
208208
new SparkConf(false).setAll(settings)
209209
}
210210

211+
/** Print any necessary deprecation warnings based on the values set in this configuration. */
212+
private[spark] def printDeprecationWarnings() {
213+
if (settings.contains("spark.local.dir")) {
214+
val msg = "In Spark 1.0 and later spark.local.dir will be overridden by the value set by " +
215+
"the cluster manager (via SPARK_LOCAL_DIRS in mesos/standalone and LOCAL_DIRS in YARN)."
216+
logWarning(msg)
217+
}
218+
}
219+
211220
/**
212221
* Return a string listing all keys and values, one per line. This is useful to print the
213222
* configuration out for debugging.

core/src/main/scala/org/apache/spark/executor/Executor.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,10 @@ private[spark] class Executor(
6464
// to what Yarn on this system said was available. This will be used later when SparkEnv
6565
// created.
6666
if (java.lang.Boolean.valueOf(
67-
System.getProperty("SPARK_YARN_MODE", System.getenv("SPARK_YARN_MODE"))))
68-
{
67+
System.getProperty("SPARK_YARN_MODE", System.getenv("SPARK_YARN_MODE")))) {
6968
conf.set("spark.local.dir", getYarnLocalDirs())
69+
} else if (sys.env.contains("SPARK_LOCAL_DIRS")) {
70+
conf.set("spark.local.dir", sys.env("SPARK_LOCAL_DIRS"))
7071
}
7172

7273
if (!isLocal) {

docs/configuration.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ there are at least five properties that you will commonly want to control:
7373
Directory to use for "scratch" space in Spark, including map output files and RDDs that get stored
7474
on disk. This should be on a fast, local disk in your system. It can also be a comma-separated
7575
list of multiple directories on different disks.
76+
77+
NOTE: In Spark 1.0 and later this will be overriden by SPARK_LOCAL_DIRS (Standalone, Mesos) or
78+
LOCAL_DIRS (YARN) envrionment variables set by the cluster manager.
7679
</td>
7780
</tr>
7881
<tr>
@@ -671,8 +674,7 @@ The following variables can be set in `spark-env.sh`:
671674
Note that applications can also add dependencies for themselves through `SparkContext.addJar` -- we recommend
672675
doing that when possible.
673676
* `SPARK_JAVA_OPTS`, to add JVM options. This includes Java options like garbage collector settings and any system
674-
properties that you'd like to pass with `-D`. One use case is to set some Spark properties differently on this
675-
machine, e.g., `-Dspark.local.dir=/disk1,/disk2`.
677+
properties that you'd like to pass with `-D`.
676678
* Options for the Spark [standalone cluster scripts](spark-standalone.html#cluster-launch-scripts), such as number of cores
677679
to use on each machine and maximum memory.
678680

0 commit comments

Comments
 (0)