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

    https://github.com/apache/spark/pull/1218#discussion_r16205250
  
    --- Diff: 
core/src/main/scala/org/apache/spark/deploy/history/FsHistoryProvider.scala ---
    @@ -117,84 +145,88 @@ private[history] class FsHistoryProvider(conf: 
SparkConf) extends ApplicationHis
         try {
           val logStatus = fs.listStatus(new Path(resolvedLogDir))
           val logDirs = if (logStatus != null) logStatus.filter(_.isDir).toSeq 
else Seq[FileStatus]()
    -      val logInfos = logDirs.filter { dir =>
    -        fs.isFile(new Path(dir.getPath, 
EventLoggingListener.APPLICATION_COMPLETE))
    -      }
     
    -      val currentApps = Map[String, ApplicationHistoryInfo](
    -        appList.map(app => app.id -> app):_*)
    -
    -      // For any application that either (i) is not listed or (ii) has 
changed since the last time
    -      // the listing was created (defined by the log dir's modification 
time), load the app's info.
    -      // Otherwise just reuse what's already in memory.
    -      val newApps = new 
mutable.ArrayBuffer[ApplicationHistoryInfo](logInfos.size)
    -      for (dir <- logInfos) {
    -        val curr = currentApps.getOrElse(dir.getPath().getName(), null)
    -        if (curr == null || curr.lastUpdated < getModificationTime(dir)) {
    +      // Load all new logs from the log directory. Only directories that 
have a modification time
    +      // later than the last known log directory will be loaded.
    +      var newMostRecentModTime = mostRecentLogModTime
    +      val logInfos = logDirs
    +        .filter { dir =>
    +          if (fs.isFile(new Path(dir.getPath(), 
EventLoggingListener.APPLICATION_COMPLETE))) {
    +            val modTime = getModificationTime(dir)
    +            newMostRecentModTime = math.max(newMostRecentModTime, modTime)
    +            modTime > mostRecentLogModTime
    +          } else {
    +            false
    +          }
    +        }
    +        .map { dir =>
               try {
    -            val (app, _) = loadAppInfo(dir, renderUI = false)
    -            newApps += app
    +            val (replayBus, appListener) = createReplayBus(dir)
    +            replayBus.replay()
    +            new FsApplicationHistoryInfo(
    +              dir.getPath().getName(),
    +              appListener.appId.getOrElse(dir.getPath().getName()),
    +              appListener.appName.getOrElse(NOT_STARTED),
    +              appListener.startTime.getOrElse(-1L),
    +              appListener.endTime.getOrElse(-1L),
    +              getModificationTime(dir),
    +              appListener.sparkUser.getOrElse(NOT_STARTED))
               } catch {
    -            case e: Exception => logError(s"Failed to load app info from 
directory $dir.")
    +            case e: Exception =>
    +              logInfo(s"Failed to load application log data from $dir.", e)
    +              null
    --- End diff --
    
    Why not just do a flat map here to filter out the nulls? Then we can make 
this return `None`


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