Skip to content

Commit 1b2f391

Browse files
committed
Minor changes
Rename ApplicationListener to ApplicationEventListener, and stop ReplaySparkListener in Master after use.
1 parent a9eae7e commit 1b2f391

File tree

6 files changed

+12
-11
lines changed

6 files changed

+12
-11
lines changed

core/src/main/scala/org/apache/spark/deploy/history/HistoryServer.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import org.apache.spark.deploy.SparkUIContainer
3030
import org.apache.spark.ui.SparkUI
3131
import org.apache.spark.ui.JettyUtils._
3232
import org.apache.spark.util.Utils
33-
import org.apache.spark.scheduler.{ApplicationListener, ReplayListenerBus}
33+
import org.apache.spark.scheduler.{ApplicationEventListener, ReplayListenerBus}
3434

3535
/**
3636
* A web server that renders SparkUIs of finished applications.
@@ -131,7 +131,7 @@ class HistoryServer(val baseLogDir: String, requestedPort: Int)
131131
// If the application completion file is found
132132
if (replayBus.isApplicationComplete) {
133133
val ui = new SparkUI(replayBus, appId, "/history/%s".format(appId))
134-
val appListener = new ApplicationListener
134+
val appListener = new ApplicationEventListener
135135
replayBus.addListener(appListener)
136136

137137
// Do not call ui.bind() to avoid creating a new server for each application

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,7 @@ private[spark] class Master(
666666
// Do not call ui.bind() to avoid creating a new server for each application
667667
ui.start()
668668
val success = replayBus.replay()
669+
replayBus.stop()
669670
if (success) Some(ui) else None
670671
}
671672

core/src/main/scala/org/apache/spark/scheduler/ApplicationListener.scala renamed to core/src/main/scala/org/apache/spark/scheduler/ApplicationEventListener.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ package org.apache.spark.scheduler
2424
* SparkListenerApplicationEnd will be received. Otherwise, only the latest event
2525
* of each type will take effect.
2626
*/
27-
private[spark] class ApplicationListener extends SparkListener {
27+
private[spark] class ApplicationEventListener extends SparkListener {
2828
var appName = "<Not Started>"
2929
var startTime = -1L
3030
var endTime = -1L

core/src/main/scala/org/apache/spark/scheduler/ReplayListenerBus.scala

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import org.apache.spark.io.CompressionCodec
3131
import org.apache.spark.util.{JsonProtocol, Utils}
3232

3333
/**
34-
* An EventBus that replays logged events from persisted storage.
34+
* A SparkListenerBus that replays logged events from persisted storage.
3535
*
3636
* This class expects files to be appropriately prefixed as specified in EventLoggingListener.
3737
* There exists a one-to-one mapping between ReplayListenerBus and event logging applications.
@@ -64,10 +64,9 @@ private[spark] class ReplayListenerBus(logDir: String) extends SparkListenerBus
6464
conf.set("spark.io.compression.codec", codec)
6565
CompressionCodec.createCodec(conf)
6666
}
67-
applicationComplete =
68-
filePaths.exists { file =>
69-
EventLoggingListener.isApplicationCompleteFile(file.getName)
70-
}
67+
applicationComplete = filePaths.exists { file =>
68+
EventLoggingListener.isApplicationCompleteFile(file.getName)
69+
}
7170
started = true
7271
}
7372

core/src/main/scala/org/apache/spark/scheduler/cluster/SparkDeploySchedulerBackend.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,8 @@ private[spark] class SparkDeploySchedulerBackend(
4848
val command = Command(
4949
"org.apache.spark.executor.CoarseGrainedExecutorBackend", args, sc.executorEnvs)
5050
val sparkHome = sc.getSparkHome()
51-
val eventLogDir = sc.eventLogger.map { logger => Some(logger.logDir) }.getOrElse(None)
5251
val appDesc = new ApplicationDescription(sc.appName, maxCores, sc.executorMemory, command,
53-
sparkHome, sc.ui.appUIAddress, eventLogDir)
52+
sparkHome, sc.ui.appUIAddress, sc.eventLogger.map(_.logDir))
5453

5554
client = new AppClient(sc.env.actorSystem, masters, appDesc, this, conf)
5655
client.start()

core/src/main/scala/org/apache/spark/ui/SparkUI.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ private[spark] class SparkUI(
7575
// Maintain executor storage status through Spark events
7676
val storageStatusListener = new StorageStatusListener
7777

78-
def setAppName(name: String) = appName = name
78+
def setAppName(name: String) {
79+
appName = name
80+
}
7981

8082
/** Initialize all components of the server */
8183
def start() {

0 commit comments

Comments
 (0)