Skip to content

Commit 5c1fa33

Browse files
cache exceptions when eventlog with wrong conf
1 parent f9ed2b6 commit 5c1fa33

File tree

1 file changed

+21
-19
lines changed
  • core/src/main/scala/org/apache/spark/deploy/master

1 file changed

+21
-19
lines changed

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

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -719,26 +719,28 @@ private[spark] class Master(
719719
def rebuildSparkUI(app: ApplicationInfo): Boolean = {
720720
val appName = app.desc.name
721721
val notFoundBasePath = HistoryServer.UI_PATH_PREFIX + "/not-found"
722-
val eventLogFile = app.desc.eventLogDir
723-
.map { dir => EventLoggingListener.getLogPath(dir, app.id) }
724-
.getOrElse {
725-
// Event logging is not enabled for this application
726-
app.desc.appUiUrl = notFoundBasePath
727-
return false
728-
}
729-
val fs = Utils.getHadoopFileSystem(eventLogFile, hadoopConf)
722+
var eventLogFile: String = null
723+
try {
724+
eventLogFile = app.desc.eventLogDir
725+
.map { dir => EventLoggingListener.getLogPath(dir, app.id) }
726+
.getOrElse {
727+
// Event logging is not enabled for this application
728+
app.desc.appUiUrl = notFoundBasePath
729+
return false
730+
}
731+
732+
val fs = Utils.getHadoopFileSystem(eventLogFile, hadoopConf)
730733

731-
if (fs.exists(new Path(eventLogFile + EventLoggingListener.IN_PROGRESS))) {
732-
// Event logging is enabled for this application, but the application is still in progress
733-
val title = s"Application history not found (${app.id})"
734-
var msg = s"Application $appName is still in progress."
735-
logWarning(msg)
736-
msg = URLEncoder.encode(msg, "UTF-8")
737-
app.desc.appUiUrl = notFoundBasePath + s"?msg=$msg&title=$title"
738-
return false
739-
}
734+
if (fs.exists(new Path(eventLogFile + EventLoggingListener.IN_PROGRESS))) {
735+
// Event logging is enabled for this application, but the application is still in progress
736+
val title = s"Application history not found (${app.id})"
737+
var msg = s"Application $appName is still in progress."
738+
logWarning(msg)
739+
msg = URLEncoder.encode(msg, "UTF-8")
740+
app.desc.appUiUrl = notFoundBasePath + s"?msg=$msg&title=$title"
741+
return false
742+
}
740743

741-
try {
742744
val (logInput, sparkVersion) = EventLoggingListener.openEventLog(new Path(eventLogFile), fs)
743745
val replayBus = new ReplayListenerBus()
744746
val ui = SparkUI.createHistoryUI(new SparkConf, replayBus, new SecurityManager(conf),
@@ -764,7 +766,7 @@ private[spark] class Master(
764766
app.desc.appUiUrl = notFoundBasePath + s"?msg=$msg&title=$title"
765767
false
766768
case e: Exception =>
767-
// Relay exception message to application UI page
769+
// Replay exception message to application UI page
768770
val title = s"Application history load error (${app.id})"
769771
val exception = URLEncoder.encode(Utils.exceptionString(e), "UTF-8")
770772
var msg = s"Exception in replaying log for application $appName!"

0 commit comments

Comments
 (0)