@@ -32,7 +32,7 @@ import org.apache.spark.ui.JettyUtils._
3232import org .apache .spark .util .Utils
3333
3434/**
35- * A web server that renders SparkUIs of finished applications.
35+ * A web server that renders SparkUIs of completed applications.
3636 *
3737 * For the standalone mode, MasterWebUI already achieves this functionality. Thus, the
3838 * main use case of the HistoryServer is in other deploy modes (e.g. Yarn or Mesos).
@@ -61,8 +61,8 @@ class HistoryServer(
6161 // A timestamp of when the disk was last accessed to check for log updates
6262 private var lastLogCheckTime = - 1L
6363
64- // Number of complete applications found in this directory
65- private var numApplicationsTotal = 0
64+ // Number of completed applications found in this directory
65+ private var numCompletedApplications = 0
6666
6767 @ volatile private var stopped = false
6868
@@ -125,11 +125,11 @@ class HistoryServer(
125125 * Check for any updates to event logs in the base directory. This is only effective once
126126 * the server has been bound.
127127 *
128- * If a new finished application is found, the server renders the associated SparkUI
128+ * If a new completed application is found, the server renders the associated SparkUI
129129 * from the application's event logs, attaches this UI to itself, and stores metadata
130130 * information for this application.
131131 *
132- * If the logs for an existing finished application are no longer found, the server
132+ * If the logs for an existing completed application are no longer found, the server
133133 * removes all associated information and detaches the SparkUI.
134134 */
135135 def checkForLogs () = synchronized {
@@ -164,8 +164,8 @@ class HistoryServer(
164164 }
165165 }
166166
167- // Track the total number of complete applications observed this round
168- numApplicationsTotal = logInfos.size
167+ // Track the total number of completed applications observed this round
168+ numCompletedApplications = logInfos.size
169169
170170 } catch {
171171 case t : Throwable => logError(" Exception in checking for event log updates" , t)
@@ -176,10 +176,10 @@ class HistoryServer(
176176 }
177177
178178 /**
179- * Render a new SparkUI from the event logs if the associated application is finished .
179+ * Render a new SparkUI from the event logs if the associated application is completed .
180180 *
181181 * HistoryServer looks for a special file that indicates application completion in the given
182- * directory. If this file exists, the associated application is regarded to be complete , in
182+ * directory. If this file exists, the associated application is regarded to be completed , in
183183 * which case the server proceeds to render the SparkUI. Otherwise, the server does nothing.
184184 */
185185 private def renderSparkUI (logDir : FileStatus , logInfo : EventLoggingInfo ) {
@@ -200,7 +200,7 @@ class HistoryServer(
200200 val startTime = appListener.startTime
201201 val endTime = appListener.endTime
202202 val lastUpdated = getModificationTime(logDir)
203- ui.setAppName(appName + " (finished )" )
203+ ui.setAppName(appName + " (completed )" )
204204 appIdToInfo(appId) = ApplicationHistoryInfo (appId, appName, startTime, endTime,
205205 lastUpdated, sparkUser, path, ui)
206206 }
@@ -216,14 +216,14 @@ class HistoryServer(
216216 /** Return the address of this server. */
217217 def getAddress : String = " http://" + publicHost + " :" + boundPort
218218
219- /** Return the total number of application logs found, whether or not the UI is retained . */
220- def getNumApplications : Int = numApplicationsTotal
219+ /** Return the number of completed applications found, whether or not the UI is rendered . */
220+ def getNumApplications : Int = numCompletedApplications
221221
222222 /** Return when this directory was last modified. */
223223 private def getModificationTime (dir : FileStatus ): Long = {
224224 try {
225225 val logFiles = fileSystem.listStatus(dir.getPath)
226- if (logFiles != null ) {
226+ if (logFiles != null && ! logFiles.isEmpty ) {
227227 logFiles.map(_.getModificationTime).max
228228 } else {
229229 dir.getModificationTime
@@ -283,5 +283,5 @@ private[spark] case class ApplicationHistoryInfo(
283283 logDirPath : Path ,
284284 ui : SparkUI ) {
285285 def started = startTime != - 1
286- def finished = endTime != - 1
286+ def completed = endTime != - 1
287287}
0 commit comments