diff options
author | Andrew Rowson <github@growse.com> | 2015-02-12 18:41:39 +0000 |
---|---|---|
committer | Sean Owen <sowen@cloudera.com> | 2015-02-12 18:41:39 +0000 |
commit | 466b1f671b21f575d28f9c103f51765790914fe3 (patch) | |
tree | 89090140c3548d24a5318c3ad01e7ec5177a73e3 | |
parent | 9a6efbccf9eb3ab13295dfd204df8e58e5112209 (diff) | |
download | spark-466b1f671b21f575d28f9c103f51765790914fe3.tar.gz spark-466b1f671b21f575d28f9c103f51765790914fe3.tar.bz2 spark-466b1f671b21f575d28f9c103f51765790914fe3.zip |
[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 <github@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
-rw-r--r-- | core/src/main/scala/org/apache/spark/util/Utils.scala | 11 |
1 files changed, 3 insertions, 8 deletions
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 6af8dd555f..c06bd6fab0 100644 --- a/core/src/main/scala/org/apache/spark/util/Utils.scala +++ b/core/src/main/scala/org/apache/spark/util/Utils.scala @@ -283,13 +283,6 @@ private[spark] object Utils extends Logging { dir = new File(root, namePrefix + "-" + 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; } } @@ -703,7 +696,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 |