Github user tgravescs commented on a diff in the pull request:

    https://github.com/apache/spark/pull/2002#discussion_r16363882
  
    --- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
    @@ -451,10 +451,56 @@ private[spark] object Utils extends Logging {
       /**
        * Get a temporary directory using Spark's spark.local.dir property, if 
set. This will always
        * return a single directory, even though the spark.local.dir property 
might be a list of
    -   * multiple paths.
    +   * multiple paths.  If the SPARK_LOCAL_DIRS environment variable is set, 
then this will return
    +   * a directory from that variable.
        */
       def getLocalDir(conf: SparkConf): String = {
    -    conf.get("spark.local.dir",  
System.getProperty("java.io.tmpdir")).split(',')(0)
    +    getOrCreateLocalRootDirs(conf)(0)
    +  }
    +
    +  /**
    +   * Gets or creates the directories listed in spark.local.dir or 
SPARK_LOCAL_DIRS,
    +   * and returns only the directories that exist / could be created.
    +   */
    +  private[spark] def getOrCreateLocalRootDirs(conf: SparkConf): 
Array[String] = {
    +    val isYarn = java.lang.Boolean.valueOf(
    +      System.getProperty("SPARK_YARN_MODE", 
conf.getenv("SPARK_YARN_MODE")))
    --- End diff --
    
    The changes look fine for yarn.  This way does have more logic to look it 
up and check for existence every time its called, but as long as this isn't 
called very many times it shouldn't be a problem.  I think its only called 3 
times right now (DiskManager, Broadcast, and potentially on fetchfile).  I 
guess if you are fetching a lot of files and have a lot of disks (you can 
easily have systems with 12+ disks) it could be excessive to keep looking up 
and checking.
    
    There is also logic in the ApplicationMaster and ExecutorLauncher (for both 
stable and alpha) for yarn for setting the spark.local.dir. I think we can also 
remove that code.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to