Skip to content

Commit

Permalink
Address review comments:
Browse files Browse the repository at this point in the history
- check for different env. vars.
- fix logging message
  • Loading branch information
JoshRosen committed Aug 19, 2014
1 parent 1dec709 commit efad8c6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions core/src/main/scala/org/apache/spark/util/Utils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,10 @@ private[spark] object Utils extends Logging {
}

private[spark] def isRunningInYarnContainer(conf: SparkConf): Boolean = {
conf.getenv("NM_HOST") != null || conf.getenv("CONTAINER_ID") != null
// These environment variables are set by YARN.
// For Hadoop 0.23.X, we check for YARN_LOCAL_DIRS (we use this below in getYarnLocalDirs())
// For Hadoop 2.X, we check for CONTAINER_ID.
conf.getenv("CONTAINER_ID") != null || conf.getenv("YARN_LOCAL_DIRS") != null
}

/**
Expand All @@ -484,7 +487,7 @@ private[spark] object Utils extends Logging {
conf.get("spark.local.dir", System.getProperty("java.io.tmpdir")))
}
val rootDirs = confValue.split(',')
logDebug(s"Getting/creating local root dirs at '$rootDirs'")
logDebug(s"Getting/creating local root dirs at '$confValue'")

rootDirs.flatMap { rootDir =>
val localDir: File = new File(rootDir)
Expand Down

0 comments on commit efad8c6

Please sign in to comment.