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

    https://github.com/apache/spark/pull/8358#discussion_r42298202
  
    --- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
    @@ -655,15 +655,19 @@ private[spark] object Utils extends Logging {
           // created the directories already, and that they are secured so 
that only the
           // user has access to them.
           getYarnLocalDirs(conf).split(",")
    +    } else if (conf.getenv("SPARK_LOCAL_DIRS") != null) {
    +      conf.getenv("SPARK_LOCAL_DIRS").split(",")
         } else if (conf.getenv("SPARK_EXECUTOR_DIRS") != null) {
           conf.getenv("SPARK_EXECUTOR_DIRS").split(File.pathSeparator)
    +    } else if (conf.getenv("MESOS_DIRECTORY") != null
    +      && !conf.getBoolean("spark.shuffle.service.enabled", false)) {
    +      // running inside Mesos and have a local directory to use
    +      Array(conf.getenv("MESOS_DIRECTORY"))
         } else {
           // In non-Yarn mode (or for the driver in yarn-client mode), we 
cannot trust the user
           // configuration to point to a secure directory. So create a 
subdirectory with restricted
           // permissions under each listed directory.
    -      Option(conf.getenv("SPARK_LOCAL_DIRS"))
    -        .getOrElse(conf.get("spark.local.dir", 
System.getProperty("java.io.tmpdir")))
    -        .split(",")
    +      conf.get("spark.local.dir", 
System.getProperty("java.io.tmpdir")).split(",")
    --- End diff --
    
    actually, we can rewrite this whole thing as:
    ```
    // In non-YARN mode ...
    Option(conf.getenv("SPARK_EXECUTOR_DIRS")).map(_.split(File.pathSeparator))
      .orElse(Option(conf.getenv("SPARK_LOCAL_DIRS")).map(_.split(",")))
      // Mesos already creates a directory per ...
      .orElse(Option(conf.getenv("MESOS_DIRECTORY")).map(_.toSeq))
      .orElse(conf.getOption("spark.local.dir").map(_.split(",")))
      .getOrElse(sys.props("java.io.tmpdir").split(","))
      .toArray
    ```
    I think the precedence is a little clearer this way


---
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