aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/src/main/scala/spark/executor/Executor.scala15
-rw-r--r--yarn/src/main/scala/spark/deploy/yarn/ApplicationMaster.scala15
2 files changed, 12 insertions, 18 deletions
diff --git a/core/src/main/scala/spark/executor/Executor.scala b/core/src/main/scala/spark/executor/Executor.scala
index 9e0356a711..25f55b391b 100644
--- a/core/src/main/scala/spark/executor/Executor.scala
+++ b/core/src/main/scala/spark/executor/Executor.scala
@@ -119,15 +119,12 @@ private[spark] class Executor(
// Hadoop 0.23 and 2.x have different Environment variable names for the
// local dirs, so lets check both. We assume one of the 2 is set.
// LOCAL_DIRS => 2.X, YARN_LOCAL_DIRS => 0.23.X
- var localDirs = System.getenv("LOCAL_DIRS")
- val yarnLocalSysDirs = Option(System.getenv("YARN_LOCAL_DIRS"))
- yarnLocalSysDirs match {
- case Some(s) => localDirs = s
- case None => {
- if ((localDirs == null) || (localDirs.isEmpty())) {
- throw new Exception("Yarn Local dirs can't be empty")
- }
- }
+ val localDirs = Option(System.getenv("YARN_LOCAL_DIRS"))
+ .getOrElse(Option(System.getenv("LOCAL_DIRS"))
+ .getOrElse(""))
+
+ if (localDirs.isEmpty()) {
+ throw new Exception("Yarn Local dirs can't be empty")
}
return localDirs
}
diff --git a/yarn/src/main/scala/spark/deploy/yarn/ApplicationMaster.scala b/yarn/src/main/scala/spark/deploy/yarn/ApplicationMaster.scala
index 33e6293a6b..0f3b6bc1a6 100644
--- a/yarn/src/main/scala/spark/deploy/yarn/ApplicationMaster.scala
+++ b/yarn/src/main/scala/spark/deploy/yarn/ApplicationMaster.scala
@@ -98,15 +98,12 @@ class ApplicationMaster(args: ApplicationMasterArguments, conf: Configuration) e
// Hadoop 0.23 and 2.x have different Environment variable names for the
// local dirs, so lets check both. We assume one of the 2 is set.
// LOCAL_DIRS => 2.X, YARN_LOCAL_DIRS => 0.23.X
- var localDirs = System.getenv("LOCAL_DIRS")
- val yarnLocalSysDirs = Option(System.getenv("YARN_LOCAL_DIRS"))
- yarnLocalSysDirs match {
- case Some(s) => localDirs = s
- case None => {
- if ((localDirs == null) || (localDirs.isEmpty())) {
- throw new Exception("Yarn Local dirs can't be empty")
- }
- }
+ val localDirs = Option(System.getenv("YARN_LOCAL_DIRS"))
+ .getOrElse(Option(System.getenv("LOCAL_DIRS"))
+ .getOrElse(""))
+
+ if (localDirs.isEmpty()) {
+ throw new Exception("Yarn Local dirs can't be empty")
}
return localDirs
}