Skip to content

Commit

Permalink
Comments, imports and formatting (minor)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewor14 committed Apr 3, 2014
1 parent cd000b0 commit a37ad4f
Show file tree
Hide file tree
Showing 16 changed files with 28 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ private[spark] class Master(
val masterSource = new MasterSource(this)

val webUi = new MasterWebUI(this, webUiPort)
webUi.start()

val masterPublicAddress = {
val envVar = System.getenv("SPARK_PUBLIC_DNS")
Expand Down Expand Up @@ -116,6 +115,7 @@ private[spark] class Master(
logInfo("Starting Spark master at " + masterUrl)
// Listen for remote client disconnection events, since they don't go through Akka's watch()
context.system.eventStream.subscribe(self, classOf[RemotingLifecycleEvent])
webUi.start()
webUi.bind()
masterWebUiUrl = "http://" + masterPublicAddress + ":" + webUi.boundPort
context.system.scheduler.schedule(0 millis, WORKER_TIMEOUT millis, self, CheckForWorkerTimeOut)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class MasterWebUI(val master: Master, requestedPort: Int)
val masterActorRef = master.self
val timeout = AkkaUtils.askTimeout(master.conf)

/** Initialize all components of the server. Must be called before bind(). */
def start() {
attachPage(new ApplicationPage(this))
attachPage(new IndexPage(this))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ private[spark] class Worker(
host, port, cores, Utils.megabytesToString(memory)))
logInfo("Spark home: " + sparkHome)
createWorkDir()
context.system.eventStream.subscribe(self, classOf[RemotingLifecycleEvent])
webUi = new WorkerWebUI(this, workDir, Some(webUiPort))
webUi.start()
webUi.bind()
context.system.eventStream.subscribe(self, classOf[RemotingLifecycleEvent])
registerWithMaster()

metricsSystem.registerSource(workerSource)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class WorkerWebUI(val worker: Worker, val workDir: File, requestedPort: Option[I
worker.conf.get("worker.ui.port", WorkerWebUI.DEFAULT_PORT).toInt)
val timeout = AkkaUtils.askTimeout(worker.conf)

/** Initialize all components of the server. Must be called before bind(). */
def start() {
val logPage = new LogPage(this)
attachPage(logPage)
Expand Down
13 changes: 9 additions & 4 deletions core/src/main/scala/org/apache/spark/ui/WebUI.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@ package org.apache.spark.ui

import javax.servlet.http.HttpServletRequest

import scala.collection.mutable.ArrayBuffer
import scala.xml.Node

import org.eclipse.jetty.servlet.ServletContextHandler
import org.json4s.JsonAST.{JNothing, JValue}

import org.apache.spark.SecurityManager
import org.apache.spark.scheduler.SparkListener
import org.apache.spark.ui.JettyUtils._
import org.apache.spark.util.Utils
import scala.collection.mutable.ArrayBuffer
import org.apache.spark.scheduler.SparkListener
import scala.xml.Node
import org.json4s.JsonAST.{JNothing, JValue}

/**
* The top level component of the UI hierarchy that contains the server.
Expand Down Expand Up @@ -70,6 +71,9 @@ private[spark] abstract class WebUI(securityManager: SecurityManager, basePath:
/** Return a list of handlers attached to this UI. */
def getHandlers = handlers.toSeq

/** Initialize all components of the server. Must be called before bind(). */
def start()

/**
* Bind to the HTTP server behind this web interface.
* Overridden implementation should set serverInfo.
Expand Down Expand Up @@ -101,6 +105,7 @@ private[spark] abstract class UITab(val prefix: String) {
pages += page
}

/** Initialize listener and attach pages. */
def start()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ private[ui] class EnvironmentTab(parent: SparkUI) extends UITab("environment") {
attachPage(new IndexPage(this))
}

def environmentListener = {
def environmentListener: EnvironmentListener = {
assert(listener.isDefined, "EnvironmentTab has not started yet!")
listener.get.asInstanceOf[EnvironmentListener]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ private[ui] class ExecutorsTab(parent: SparkUI) extends UITab("executors") {
attachPage(new IndexPage(this))
}

def executorsListener = {
def executorsListener: ExecutorsListener = {
assert(listener.isDefined, "ExecutorsTab has not started yet!")
listener.get.asInstanceOf[ExecutorsListener]
}
Expand Down
10 changes: 5 additions & 5 deletions core/src/main/scala/org/apache/spark/ui/exec/IndexPage.scala
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ private[ui] class IndexPage(parent: ExecutorsTab) extends UIPage("") {
</ul>
</div>
</div>
<div class = "row">
<div class="span12">
{execTable}
</div>
</div>;
<div class = "row">
<div class="span12">
{execTable}
</div>
</div>;

UIUtils.headerSparkPage(
content, basePath, appName, "Executors (" + execInfo.size + ")", Executors)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import javax.servlet.http.HttpServletRequest
import scala.xml.{Node, NodeSeq}

import org.apache.spark.scheduler.Schedulable
import org.apache.spark.ui.Page._
import org.apache.spark.ui.{UIPage, UIUtils}
import org.apache.spark.ui.Page.Stages

/** Page showing list of all ongoing and recently finished stages and pools */
private[ui] class IndexPage(parent: JobProgressTab) extends UIPage("") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private[ui] class JobProgressTab(parent: SparkUI) extends UITab("stages") {
attachPage(new PoolPage(this))
}

def jobProgressListener = {
def jobProgressListener: JobProgressListener = {
assert(listener.isDefined, "JobProgressTab has not started yet!")
listener.get.asInstanceOf[JobProgressListener]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import javax.servlet.http.HttpServletRequest
import scala.xml.Node

import org.apache.spark.scheduler.{Schedulable, StageInfo}
import org.apache.spark.ui.Page._
import org.apache.spark.ui.{UIPage, UIUtils}
import org.apache.spark.ui.Page.Stages

/** Page showing specific pool details */
private[ui] class PoolPage(parent: JobProgressTab) extends UIPage("pool") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import javax.servlet.http.HttpServletRequest

import scala.xml.Node

import org.apache.spark.ui.Page._
import org.apache.spark.ui.{UIPage, UIUtils}
import org.apache.spark.ui.Page.Stages
import org.apache.spark.util.{Utils, Distribution}

/** Page showing statistics and task list for a given stage */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import scala.collection.mutable.HashMap
import scala.xml.Node

import org.apache.spark.scheduler.{StageInfo, TaskInfo}
import org.apache.spark.ui.{WebUI, UIUtils}
import org.apache.spark.ui.UIUtils
import org.apache.spark.util.Utils

/** Page showing list of all ongoing and recently finished stages */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ private[ui] class BlockManagerTab(parent: SparkUI) extends UITab("storage") {
attachPage(new RddPage(this))
}

def blockManagerListener = {
def blockManagerListener: BlockManagerListener = {
assert(listener.isDefined, "BlockManagerTab has not started yet!")
listener.get.asInstanceOf[BlockManagerListener]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import javax.servlet.http.HttpServletRequest
import scala.xml.Node

import org.apache.spark.storage.RDDInfo
import org.apache.spark.ui.Page._
import org.apache.spark.ui.{UIPage, UIUtils}
import org.apache.spark.ui.Page.Storage
import org.apache.spark.util.Utils

/** Page showing list of RDD's currently stored in the cluster */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import javax.servlet.http.HttpServletRequest
import scala.xml.Node

import org.apache.spark.storage.{BlockId, BlockStatus, StorageStatus, StorageUtils}
import org.apache.spark.ui.Page._
import org.apache.spark.ui.{UIPage, UIUtils}
import org.apache.spark.ui.Page.Storage
import org.apache.spark.util.Utils

/** Page showing storage details for a given RDD */
Expand Down

0 comments on commit a37ad4f

Please sign in to comment.