Github user andrewor14 commented on a diff in the pull request:
https://github.com/apache/spark/pull/1222#discussion_r21583427
--- Diff:
core/src/main/scala/org/apache/spark/deploy/history/FsHistoryProvider.scala ---
@@ -221,33 +238,87 @@ private[history] class FsHistoryProvider(conf:
SparkConf) extends ApplicationHis
}
}
- private def createReplayBus(logDir: FileStatus): (ReplayListenerBus,
ApplicationEventListener) = {
- val path = logDir.getPath()
- val elogInfo = EventLoggingListener.parseLoggingInfo(path, fs)
- val replayBus = new ReplayListenerBus(elogInfo.logPaths, fs,
elogInfo.compressionCodec)
- val appListener = new ApplicationEventListener
- replayBus.addListener(appListener)
- (replayBus, appListener)
+ /**
+ * Replays the event data in the given log, and returns the application
information.
+ */
+ private def replay(logPath: FileStatus, bus: ReplayListenerBus):
FsApplicationHistoryInfo = {
+ val (logInput, sparkVersion) =
+ if (isLegacyLogDirectory(logPath)) {
+ openOldLog(logPath.getPath())
+ } else {
+ EventLoggingListener.openEventLog(logPath.getPath(), fs)
+ }
+ try {
+ val appListener = new ApplicationEventListener
+ bus.addListener(appListener)
+ bus.replay(logInput, sparkVersion)
+ new FsApplicationHistoryInfo(
+ logPath.getPath().getName(),
+ appListener.appId.getOrElse(logPath.getPath().getName()),
+ appListener.appName.getOrElse(NOT_STARTED),
+ appListener.startTime.getOrElse(-1L),
+ appListener.endTime.getOrElse(-1L),
+ getModificationTime(logPath),
+ appListener.sparkUser.getOrElse(NOT_STARTED))
+ } finally {
+ logInput.close()
+ }
}
- /** Return when this directory was last modified. */
- private def getModificationTime(dir: FileStatus): Long = {
- try {
- val logFiles = fs.listStatus(dir.getPath)
- if (logFiles != null && !logFiles.isEmpty) {
- logFiles.map(_.getModificationTime).max
- } else {
- dir.getModificationTime
+ /**
+ * Load the a legacy log directory. This assumes that the log directory
contains a single event
+ * log file, which is the case for directories generated by the code in
previous releases.
--- End diff --
you should add `single event log file, along with other files containing
application meta data`. From this description alone it's not clear how the
legacy directory is different from the new structure.
---
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]