spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rxin <...@git.apache.org>
Subject [GitHub] spark pull request #20706: [SPARK-23550][core] Cleanup `Utils`.
Date Thu, 01 Mar 2018 19:26:05 GMT
Github user rxin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20706#discussion_r171666996
  
    --- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
    @@ -267,44 +264,20 @@ private[spark] object Utils extends Logging {
         }
       }
     
    -  /**
    -   * JDK equivalent of `chmod 700 file`.
    -   *
    -   * @param file the file whose permissions will be modified
    -   * @return true if the permissions were successfully changed, false otherwise.
    -   */
    -  def chmod700(file: File): Boolean = {
    -    file.setReadable(false, false) &&
    -    file.setReadable(true, true) &&
    -    file.setWritable(false, false) &&
    -    file.setWritable(true, true) &&
    -    file.setExecutable(false, false) &&
    -    file.setExecutable(true, true)
    -  }
    -
       /**
        * Create a directory inside the given parent directory. The directory is guaranteed
to be
        * newly created, and is not marked for automatic deletion.
        */
       def createDirectory(root: String, namePrefix: String = "spark"): File = {
    -    var attempts = 0
    -    val maxAttempts = MAX_DIR_CREATION_ATTEMPTS
    -    var dir: File = null
    -    while (dir == null) {
    -      attempts += 1
    -      if (attempts > maxAttempts) {
    -        throw new IOException("Failed to create a temp directory (under " + root + ")
after " +
    -          maxAttempts + " attempts!")
    -      }
    -      try {
    -        dir = new File(root, namePrefix + "-" + UUID.randomUUID.toString)
    -        if (dir.exists() || !dir.mkdirs()) {
    -          dir = null
    -        }
    -      } catch { case e: SecurityException => dir = null; }
    +    val prefix = namePrefix + "-"
    --- End diff --
    
    was there a reason you rewriting this?



---

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


Mime
View raw message