Repository: spark
Updated Branches:
  refs/heads/branch-1.2 53de2378e -> 64254eeec


[SPARK-5655] Don't chmod700 application files if running in YARN

[Was previously PR4507]

As per SPARK-5655, recently committed code chmod 700s all application files 
created on the local fs by a spark executor. This is both unnecessary and 
broken on YARN, where files created in the nodemanager's working directory are 
already owned by the user running the job and the 'yarn' group. Group read 
permission is also needed for the auxiliary shuffle service to be able to read 
the files, as this is running as the 'yarn' user.

Author: Andrew Rowson <git...@growse.com>

Closes #4509 from growse/master and squashes the following commits:

7ca993c [Andrew Rowson] Moved chmod700 functionality into 
Utils.getOrCreateLocalRootDirs
f57ce6b [Andrew Rowson] [SPARK-5655] Don't chmod700 application files if 
running in a YARN container

(cherry picked from commit 466b1f671b21f575d28f9c103f51765790914fe3)
Signed-off-by: Sean Owen <so...@cloudera.com>


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/64254eee
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/64254eee
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/64254eee

Branch: refs/heads/branch-1.2
Commit: 64254eeec491af969264900c1d992081b2b635b4
Parents: 53de237
Author: Andrew Rowson <git...@growse.com>
Authored: Thu Feb 12 18:41:39 2015 +0000
Committer: Sean Owen <so...@cloudera.com>
Committed: Thu Feb 12 19:12:16 2015 +0000

----------------------------------------------------------------------
 core/src/main/scala/org/apache/spark/util/Utils.scala | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/64254eee/core/src/main/scala/org/apache/spark/util/Utils.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/org/apache/spark/util/Utils.scala 
b/core/src/main/scala/org/apache/spark/util/Utils.scala
index a2eebbc..b92de55 100644
--- a/core/src/main/scala/org/apache/spark/util/Utils.scala
+++ b/core/src/main/scala/org/apache/spark/util/Utils.scala
@@ -281,13 +281,6 @@ private[spark] object Utils extends Logging {
         dir = new File(root, "spark-" + UUID.randomUUID.toString)
         if (dir.exists() || !dir.mkdirs()) {
           dir = null
-        } else {
-          // Restrict file permissions via chmod if available.
-          // For Windows this step is ignored.
-          if (!isWindows && !chmod700(dir)) {
-            dir.delete()
-            dir = null
-          }
         }
       } catch { case e: SecurityException => dir = null; }
     }
@@ -642,7 +635,9 @@ private[spark] object Utils extends Logging {
           try {
             val rootDir = new File(root)
             if (rootDir.exists || rootDir.mkdirs()) {
-              Some(createDirectory(root).getAbsolutePath())
+              val dir = createDirectory(root)
+              chmod700(dir)
+              Some(dir.getAbsolutePath)
             } else {
               logError(s"Failed to create dir in $root. Ignoring this 
directory.")
               None


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

Reply via email to