diff options
author | Y.CORP.YAHOO.COM\tgraves <tgraves@thatenemy-lm.champ.corp.yahoo.com> | 2013-08-27 14:34:27 -0500 |
---|---|---|
committer | Y.CORP.YAHOO.COM\tgraves <tgraves@thatenemy-lm.champ.corp.yahoo.com> | 2013-08-27 14:34:27 -0500 |
commit | 3f206bf0b56888c718983b7832677a894e36eee3 (patch) | |
tree | 264d7365a827998da79494288564118beba5ab9a | |
parent | cf52a3cba6cce34d5d4da3da285c9d49d4ed3ceb (diff) | |
download | spark-3f206bf0b56888c718983b7832677a894e36eee3.tar.gz spark-3f206bf0b56888c718983b7832677a894e36eee3.tar.bz2 spark-3f206bf0b56888c718983b7832677a894e36eee3.zip |
Updated based on review comments.
-rw-r--r-- | core/src/main/scala/spark/executor/Executor.scala | 15 | ||||
-rw-r--r-- | yarn/src/main/scala/spark/deploy/yarn/ApplicationMaster.scala | 15 |
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 } |