Skip to content

Commit 252c566

Browse files
committed
Merge pull request #8 from andrewor14/ui-refactor
Address Patrick's comments
2 parents 89dae36 + 125a054 commit 252c566

File tree

21 files changed

+36
-36
lines changed

21 files changed

+36
-36
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import org.apache.spark.ui.{WebUIPage, UIUtils}
2525

2626
private[spark] class IndexPage(parent: HistoryServer) extends WebUIPage("") {
2727

28-
override def render(request: HttpServletRequest): Seq[Node] = {
28+
def render(request: HttpServletRequest): Seq[Node] = {
2929
val appRows = parent.appIdToInfo.values.toSeq.sortBy { app => -app.lastUpdated }
3030
val appTable = UIUtils.listingTable(appHeader, appRow, appRows)
3131
val content =

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class HistoryServer(
131131
// Remove any applications that should no longer be retained
132132
appIdToInfo.foreach { case (appId, info) =>
133133
if (!retainedAppIds.contains(appId)) {
134-
detachUI(info.ui)
134+
detachSparkUI(info.ui)
135135
appIdToInfo.remove(appId)
136136
}
137137
}
@@ -173,7 +173,7 @@ class HistoryServer(
173173
// Do not call ui.bind() to avoid creating a new server for each application
174174
replayBus.replay()
175175
if (appListener.applicationStarted) {
176-
attachUI(ui)
176+
attachSparkUI(ui)
177177
val appName = appListener.appName
178178
val sparkUser = appListener.sparkUser
179179
val startTime = appListener.startTime
@@ -193,13 +193,13 @@ class HistoryServer(
193193
}
194194

195195
/** Attach a reconstructed UI to this server. Only valid after bind(). */
196-
private def attachUI(ui: SparkUI) {
196+
private def attachSparkUI(ui: SparkUI) {
197197
assert(serverInfo.isDefined, "HistoryServer must be bound before attaching SparkUIs")
198198
ui.getHandlers.foreach(attachHandler)
199199
}
200200

201201
/** Detach a reconstructed UI from this server. Only valid after bind(). */
202-
private def detachUI(ui: SparkUI) {
202+
private def detachSparkUI(ui: SparkUI) {
203203
assert(serverInfo.isDefined, "HistoryServer must be bound before detaching SparkUIs")
204204
ui.getHandlers.foreach(detachHandler)
205205
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ private[spark] class Master(
625625
if (completedApps.size >= RETAINED_APPLICATIONS) {
626626
val toRemove = math.max(RETAINED_APPLICATIONS / 10, 1)
627627
completedApps.take(toRemove).foreach( a => {
628-
appIdToUI.remove(a.id).foreach { ui => webUi.detachUI(ui) }
628+
appIdToUI.remove(a.id).foreach { ui => webUi.detachSparkUI(ui) }
629629
applicationMetricsSystem.removeSource(a.appSource)
630630
})
631631
completedApps.trimStart(toRemove)
@@ -672,7 +672,7 @@ private[spark] class Master(
672672
replayBus.replay()
673673
app.desc.appUiUrl = ui.basePath
674674
appIdToUI(app.id) = ui
675-
webUi.attachUI(ui)
675+
webUi.attachSparkUI(ui)
676676
return true
677677
} catch {
678678
case t: Throwable =>

core/src/main/scala/org/apache/spark/deploy/master/ui/ApplicationPage.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ import org.apache.spark.deploy.master.ExecutorInfo
3131
import org.apache.spark.ui.{WebUIPage, UIUtils}
3232
import org.apache.spark.util.Utils
3333

34-
private[spark] class ApplicationPage(parent: MasterWebUI)
35-
extends WebUIPage("app", includeJson = true) {
34+
private[spark] class ApplicationPage(parent: MasterWebUI) extends WebUIPage("app") {
3635

3736
private val master = parent.masterActorRef
3837
private val timeout = parent.timeout
@@ -49,7 +48,7 @@ private[spark] class ApplicationPage(parent: MasterWebUI)
4948
}
5049

5150
/** Executor details for a particular application */
52-
override def render(request: HttpServletRequest): Seq[Node] = {
51+
def render(request: HttpServletRequest): Seq[Node] = {
5352
val appId = request.getParameter("appId")
5453
val stateFuture = (master ? RequestMasterState)(timeout).mapTo[MasterStateResponse]
5554
val state = Await.result(stateFuture, timeout)

core/src/main/scala/org/apache/spark/deploy/master/ui/MasterPage.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import org.apache.spark.deploy.master.{ApplicationInfo, DriverInfo, WorkerInfo}
3131
import org.apache.spark.ui.{WebUIPage, UIUtils}
3232
import org.apache.spark.util.Utils
3333

34-
private[spark] class IndexPage(parent: MasterWebUI) extends WebUIPage("", includeJson = true) {
34+
private[spark] class IndexPage(parent: MasterWebUI) extends WebUIPage("") {
3535
private val master = parent.masterActorRef
3636
private val timeout = parent.timeout
3737

@@ -42,7 +42,7 @@ private[spark] class IndexPage(parent: MasterWebUI) extends WebUIPage("", includ
4242
}
4343

4444
/** Index view listing applications and executors */
45-
override def render(request: HttpServletRequest): Seq[Node] = {
45+
def render(request: HttpServletRequest): Seq[Node] = {
4646
val stateFuture = (master ? RequestMasterState)(timeout).mapTo[MasterStateResponse]
4747
val state = Await.result(stateFuture, timeout)
4848

core/src/main/scala/org/apache/spark/deploy/master/ui/MasterWebUI.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ class MasterWebUI(val master: Master, requestedPort: Int)
4545
}
4646

4747
/** Attach a reconstructed UI to this Master UI. Only valid after bind(). */
48-
def attachUI(ui: SparkUI) {
48+
def attachSparkUI(ui: SparkUI) {
4949
assert(serverInfo.isDefined, "Master UI must be bound to a server before attaching SparkUIs")
5050
ui.getHandlers.foreach(attachHandler)
5151
}
5252

5353
/** Detach a reconstructed UI from this Master UI. Only valid after bind(). */
54-
def detachUI(ui: SparkUI) {
54+
def detachSparkUI(ui: SparkUI) {
5555
assert(serverInfo.isDefined, "Master UI must be bound to a server before detaching SparkUIs")
5656
ui.getHandlers.foreach(detachHandler)
5757
}

core/src/main/scala/org/apache/spark/deploy/worker/ui/LogPage.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ private[spark] class LogPage(parent: WorkerWebUI) extends WebUIPage("logPage") {
5656
pre + Utils.offsetBytes(path, startByte, endByte)
5757
}
5858

59-
override def render(request: HttpServletRequest): Seq[Node] = {
59+
def render(request: HttpServletRequest): Seq[Node] = {
6060
val defaultBytes = 100 * 1024
6161
val appId = Option(request.getParameter("appId"))
6262
val executorId = Option(request.getParameter("executorId"))

core/src/main/scala/org/apache/spark/deploy/worker/ui/WorkerPage.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import org.apache.spark.deploy.worker.{DriverRunner, ExecutorRunner}
3131
import org.apache.spark.ui.{WebUIPage, UIUtils}
3232
import org.apache.spark.util.Utils
3333

34-
private[spark] class IndexPage(parent: WorkerWebUI) extends WebUIPage("", includeJson = true) {
34+
private[spark] class IndexPage(parent: WorkerWebUI) extends WebUIPage("") {
3535
val workerActor = parent.worker.self
3636
val worker = parent.worker
3737
val timeout = parent.timeout
@@ -42,7 +42,7 @@ private[spark] class IndexPage(parent: WorkerWebUI) extends WebUIPage("", includ
4242
JsonProtocol.writeWorkerState(workerState)
4343
}
4444

45-
override def render(request: HttpServletRequest): Seq[Node] = {
45+
def render(request: HttpServletRequest): Seq[Node] = {
4646
val stateFuture = (workerActor ? RequestWorkerState)(timeout).mapTo[WorkerStateResponse]
4747
val workerState = Await.result(stateFuture, timeout)
4848

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ private[spark] object JettyUtils extends Logging {
119119
/** Create a handler for serving files from a static directory */
120120
def createStaticHandler(resourceBase: String, path: String): ServletContextHandler = {
121121
val contextHandler = new ServletContextHandler
122+
contextHandler.setInitParameter("org.eclipse.jetty.servlet.Default.gzip", "false")
122123
val staticHandler = new DefaultServlet
123124
val holder = new ServletHolder(staticHandler)
124125
Option(getClass.getClassLoader.getResource(resourceBase)) match {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import org.apache.spark.ui.jobs.JobProgressTab
2727
import org.apache.spark.ui.storage.StorageTab
2828

2929
/**
30-
* Top level user interface for Spark.
30+
* Top level user interface for a Spark application.
3131
*/
3232
private[spark] class SparkUI(
3333
val sc: SparkContext,

0 commit comments

Comments
 (0)