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