diff options
author | Thomas Graves <tgraves@apache.org> | 2014-01-09 15:45:33 -0600 |
---|---|---|
committer | Thomas Graves <tgraves@apache.org> | 2014-01-09 15:45:33 -0600 |
commit | 9bdfbc0492f2d7408c250ae165763719cf290eeb (patch) | |
tree | 5a5f23dc99de56d574673742fcfcb9436ea1f1cc /yarn/stable/src/main | |
parent | 5fccd7051d40ca022f4d3bab661c8f53a748aa8d (diff) | |
download | spark-9bdfbc0492f2d7408c250ae165763719cf290eeb.tar.gz spark-9bdfbc0492f2d7408c250ae165763719cf290eeb.tar.bz2 spark-9bdfbc0492f2d7408c250ae165763719cf290eeb.zip |
Update based on review comments
Diffstat (limited to 'yarn/stable/src/main')
-rw-r--r-- | yarn/stable/src/main/scala/org/apache/spark/deploy/yarn/ApplicationMaster.scala | 13 | ||||
-rw-r--r-- | yarn/stable/src/main/scala/org/apache/spark/deploy/yarn/WorkerLauncher.scala | 13 |
2 files changed, 12 insertions, 14 deletions
diff --git a/yarn/stable/src/main/scala/org/apache/spark/deploy/yarn/ApplicationMaster.scala b/yarn/stable/src/main/scala/org/apache/spark/deploy/yarn/ApplicationMaster.scala index 69ae14ce83..4b777d5fa7 100644 --- a/yarn/stable/src/main/scala/org/apache/spark/deploy/yarn/ApplicationMaster.scala +++ b/yarn/stable/src/main/scala/org/apache/spark/deploy/yarn/ApplicationMaster.scala @@ -116,14 +116,13 @@ class ApplicationMaster(args: ApplicationMasterArguments, conf: Configuration, // local dirs, so lets check both. We assume one of the 2 is set. // LOCAL_DIRS => 2.X, YARN_LOCAL_DIRS => 0.23.X 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") + .orElse(Option(System.getenv("LOCAL_DIRS"))) + + localDirs match { + case None => throw new Exception("Yarn Local dirs can't be empty") + case Some(l) => l } - localDirs - } + } private def getApplicationAttemptId(): ApplicationAttemptId = { val envs = System.getenv() diff --git a/yarn/stable/src/main/scala/org/apache/spark/deploy/yarn/WorkerLauncher.scala b/yarn/stable/src/main/scala/org/apache/spark/deploy/yarn/WorkerLauncher.scala index 3e3a4672b4..78353224fa 100644 --- a/yarn/stable/src/main/scala/org/apache/spark/deploy/yarn/WorkerLauncher.scala +++ b/yarn/stable/src/main/scala/org/apache/spark/deploy/yarn/WorkerLauncher.scala @@ -117,18 +117,17 @@ class WorkerLauncher(args: ApplicationMasterArguments, conf: Configuration, spar } /** Get the Yarn approved local directories. */ - private def getLocalDirs(): String = { + private def getLocalDirs(): String = { // 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 val localDirs = Option(System.getenv("YARN_LOCAL_DIRS")) - .getOrElse(Option(System.getenv("LOCAL_DIRS")) - .getOrElse("")) + .orElse(Option(System.getenv("LOCAL_DIRS"))) - if (localDirs.isEmpty()) { - throw new Exception("Yarn Local dirs can't be empty") - } - localDirs + localDirs match { + case None => throw new Exception("Yarn Local dirs can't be empty") + case Some(l) => l + } } private def getApplicationAttemptId(): ApplicationAttemptId = { |