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

    https://github.com/apache/spark/pull/1222#discussion_r22085664
  
    --- Diff: 
core/src/main/scala/org/apache/spark/scheduler/EventLoggingListener.scala ---
    @@ -123,130 +168,153 @@ private[spark] class EventLoggingListener(
         logEvent(event, flushLogger = true)
       override def onApplicationEnd(event: SparkListenerApplicationEnd) =
         logEvent(event, flushLogger = true)
    +
       // No-op because logging every update would be overkill
       override def onExecutorMetricsUpdate(event: 
SparkListenerExecutorMetricsUpdate) { }
     
       /**
    -   * Stop logging events.
    -   * In addition, create an empty special file to indicate application 
completion.
    +   * Stop logging events. The event log file will be renamed so that it 
loses the
    +   * ".inprogress" suffix.
        */
       def stop() = {
    -    logger.newFile(APPLICATION_COMPLETE)
    -    logger.stop()
    +    writer.foreach(_.close())
    +
    +    val target = new Path(logPath)
    +    if (fileSystem.exists(target)) {
    +      if (shouldOverwrite) {
    +        logWarning(s"Event log $target already exists. Overwriting...")
    +        fileSystem.delete(target, true)
    +      } else {
    +        throw new IOException("Target log file already exists 
(%s)".format(logPath))
    +      }
    +    }
    +    fileSystem.rename(new Path(logPath + IN_PROGRESS), target)
       }
    +
     }
     
     private[spark] object EventLoggingListener extends Logging {
    +  // Suffix applied to the names of files still being written by 
applications.
    +  val IN_PROGRESS = ".inprogress"
       val DEFAULT_LOG_DIR = "/tmp/spark-events"
    -  val LOG_PREFIX = "EVENT_LOG_"
    -  val SPARK_VERSION_PREFIX = "SPARK_VERSION_"
    -  val COMPRESSION_CODEC_PREFIX = "COMPRESSION_CODEC_"
    -  val APPLICATION_COMPLETE = "APPLICATION_COMPLETE"
    -  val LOG_FILE_PERMISSIONS = new FsPermission(Integer.parseInt("770", 
8).toShort)
     
    -  // A cache for compression codecs to avoid creating the same codec many 
times
    -  private val codecMap = new mutable.HashMap[String, CompressionCodec]
    +  private val LOG_FILE_PERMISSIONS = new 
FsPermission(Integer.parseInt("770", 8).toShort)
     
    -  def isEventLogFile(fileName: String): Boolean = {
    -    fileName.startsWith(LOG_PREFIX)
    -  }
    +  // Marker for the end of header data in a log file. After this marker, 
log data, potentially
    +  // compressed, will be found.
    +  private val HEADER_END_MARKER = "=== LOG_HEADER_END ===\n"
    --- End diff --
    
    No, I just mean that it's weird that the variable itself has a new line. In 
the actual event log you would definitely need the new line.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to