Skip to content

Commit 5e0ea35

Browse files
committed
Revision for comment.
1 parent b5730a1 commit 5e0ea35

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

core/src/main/scala/org/apache/spark/deploy/ApplicationDescription.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ private[spark] class ApplicationDescription(
2323
val memoryPerSlave: Int,
2424
val command: Command,
2525
var appUiUrl: String,
26-
val eventLogFile: Option[String] = None)
26+
val eventLogDir: Option[String] = None)
2727
extends Serializable {
2828

2929
val user = System.getProperty("user.name", "<unknown>")

core/src/main/scala/org/apache/spark/deploy/master/Master.scala

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -650,11 +650,7 @@ private[spark] class Master(
650650
def createApplication(desc: ApplicationDescription, driver: ActorRef): ApplicationInfo = {
651651
val now = System.currentTimeMillis()
652652
val date = new Date(now)
653-
val appId = newApplicationId(date)
654-
val logPath = EventLoggingListener.getLogPath(desc.eventLogFile.get, appId)
655-
val newAppDesc = new ApplicationDescription(desc.name, desc.maxCores, desc.memoryPerSlave,
656-
desc.command, desc.appUiUrl, Some(logPath))
657-
new ApplicationInfo(now, appId, newAppDesc, date, driver, defaultCores)
653+
new ApplicationInfo(now, newApplicationId(date), desc, date, driver, defaultCores)
658654
}
659655

660656
def registerApplication(app: ApplicationInfo): Unit = {
@@ -718,14 +714,26 @@ private[spark] class Master(
718714
def rebuildSparkUI(app: ApplicationInfo): Boolean = {
719715
val appName = app.desc.name
720716
val notFoundBasePath = HistoryServer.UI_PATH_PREFIX + "/not-found"
721-
val eventLogFile = app.desc.eventLogFile.getOrElse {
722-
// Event logging is not enabled for this application
723-
app.desc.appUiUrl = notFoundBasePath
717+
val eventLogFile = app.desc.eventLogDir
718+
.map { dir => EventLoggingListener.getLogPath(dir, app.id) }
719+
.getOrElse {
720+
// Event logging is not enabled for this application
721+
app.desc.appUiUrl = notFoundBasePath
722+
return false
723+
}
724+
val fs = Utils.getHadoopFileSystem(eventLogFile, hadoopConf)
725+
726+
if (fs.exists(new Path(eventLogFile + EventLoggingListener.IN_PROGRESS))) {
727+
// Event logging is enabled for this application, but the application is still in progress
728+
val title = s"Application history not found (${app.id})"
729+
var msg = s"Application $appName is still in progress."
730+
logWarning(msg)
731+
msg = URLEncoder.encode(msg, "UTF-8")
732+
app.desc.appUiUrl = notFoundBasePath + s"?msg=$msg&title=$title"
724733
return false
725734
}
726735

727736
try {
728-
val fs = Utils.getHadoopFileSystem(eventLogFile, hadoopConf)
729737
val (logInput, sparkVersion) = EventLoggingListener.openEventLog(new Path(eventLogFile), fs)
730738
val replayBus = new ReplayListenerBus()
731739
val ui = SparkUI.createHistoryUI(new SparkConf, replayBus, new SecurityManager(conf),

0 commit comments

Comments
 (0)