Skip to content
Snippets Groups Projects
Commit 1a51deae authored by Reynold Xin's avatar Reynold Xin
Browse files

More minor UI changes including code review feedback.

parent 2d2a556b
No related branches found
No related tags found
No related merge requests found
...@@ -49,6 +49,10 @@ ...@@ -49,6 +49,10 @@
line-height: 15px !important; line-height: 15px !important;
} }
.table-fixed {
table-layout:fixed;
}
.table td { .table td {
vertical-align: middle !important; vertical-align: middle !important;
} }
......
...@@ -53,7 +53,7 @@ private[spark] class IndexPage(parent: MasterWebUI) { ...@@ -53,7 +53,7 @@ private[spark] class IndexPage(parent: MasterWebUI) {
val workers = state.workers.sortBy(_.id) val workers = state.workers.sortBy(_.id)
val workerTable = UIUtils.listingTable(workerHeaders, workerRow, workers) val workerTable = UIUtils.listingTable(workerHeaders, workerRow, workers)
val appHeaders = Seq("ID", "Name", "Cores", "Memory per Node", "Launch Time", "User", val appHeaders = Seq("ID", "Name", "Cores", "Memory per Node", "Submitted Time", "User",
"State", "Duration") "State", "Duration")
val activeApps = state.activeApps.sortBy(_.startTime).reverse val activeApps = state.activeApps.sortBy(_.startTime).reverse
val activeAppsTable = UIUtils.listingTable(appHeaders, appRow, activeApps) val activeAppsTable = UIUtils.listingTable(appHeaders, appRow, activeApps)
......
...@@ -125,9 +125,21 @@ private[spark] object UIUtils { ...@@ -125,9 +125,21 @@ private[spark] object UIUtils {
} }
/** Returns an HTML table constructed by generating a row for each object in a sequence. */ /** Returns an HTML table constructed by generating a row for each object in a sequence. */
def listingTable[T](headers: Seq[String], makeRow: T => Seq[Node], rows: Seq[T]): Seq[Node] = { def listingTable[T](
<table class="table table-bordered table-striped table-condensed sortable"> headers: Seq[String],
<thead>{headers.map(h => <th>{h}</th>)}</thead> makeRow: T => Seq[Node],
rows: Seq[T],
fixedWidth: Boolean = false): Seq[Node] = {
val colWidth = 100.toDouble / headers.size
val colWidthAttr = if (fixedWidth) colWidth + "%" else ""
var tableClass = "table table-bordered table-striped table-condensed sortable"
if (fixedWidth) {
tableClass += " table-fixed"
}
<table class={tableClass}>
<thead>{headers.map(h => <th width={colWidthAttr}>{h}</th>)}</thead>
<tbody> <tbody>
{rows.map(r => makeRow(r))} {rows.map(r => makeRow(r))}
</tbody> </tbody>
......
...@@ -45,7 +45,8 @@ private[spark] class EnvironmentUI(sc: SparkContext) { ...@@ -45,7 +45,8 @@ private[spark] class EnvironmentUI(sc: SparkContext) {
("Scala Home", Properties.scalaHome) ("Scala Home", Properties.scalaHome)
).sorted ).sorted
def jvmRow(kv: (String, String)) = <tr><td>{kv._1}</td><td>{kv._2}</td></tr> def jvmRow(kv: (String, String)) = <tr><td>{kv._1}</td><td>{kv._2}</td></tr>
def jvmTable = UIUtils.listingTable(Seq("Name", "Value"), jvmRow, jvmInformation) def jvmTable =
UIUtils.listingTable(Seq("Name", "Value"), jvmRow, jvmInformation, fixedWidth = true)
val properties = System.getProperties.iterator.toSeq val properties = System.getProperties.iterator.toSeq
val classPathProperty = properties.find { case (k, v) => val classPathProperty = properties.find { case (k, v) =>
...@@ -56,8 +57,10 @@ private[spark] class EnvironmentUI(sc: SparkContext) { ...@@ -56,8 +57,10 @@ private[spark] class EnvironmentUI(sc: SparkContext) {
val propertyHeaders = Seq("Name", "Value") val propertyHeaders = Seq("Name", "Value")
def propertyRow(kv: (String, String)) = <tr><td>{kv._1}</td><td>{kv._2}</td></tr> def propertyRow(kv: (String, String)) = <tr><td>{kv._1}</td><td>{kv._2}</td></tr>
val sparkPropertyTable = UIUtils.listingTable(propertyHeaders, propertyRow, sparkProperties) val sparkPropertyTable =
val otherPropertyTable = UIUtils.listingTable(propertyHeaders, propertyRow, otherProperties) UIUtils.listingTable(propertyHeaders, propertyRow, sparkProperties, fixedWidth = true)
val otherPropertyTable =
UIUtils.listingTable(propertyHeaders, propertyRow, otherProperties, fixedWidth = true)
val classPathEntries = classPathProperty._2 val classPathEntries = classPathProperty._2
.split(System.getProperty("path.separator", ":")) .split(System.getProperty("path.separator", ":"))
...@@ -69,17 +72,21 @@ private[spark] class EnvironmentUI(sc: SparkContext) { ...@@ -69,17 +72,21 @@ private[spark] class EnvironmentUI(sc: SparkContext) {
val classPathHeaders = Seq("Resource", "Source") val classPathHeaders = Seq("Resource", "Source")
def classPathRow(data: (String, String)) = <tr><td>{data._1}</td><td>{data._2}</td></tr> def classPathRow(data: (String, String)) = <tr><td>{data._1}</td><td>{data._2}</td></tr>
val classPathTable = UIUtils.listingTable(classPathHeaders, classPathRow, classPath) val classPathTable =
UIUtils.listingTable(classPathHeaders, classPathRow, classPath, fixedWidth = true)
val content = val content =
<span> <span>
<h4>Runtime Information</h4> {jvmTable} <h4>Runtime Information</h4> {jvmTable}
<hr/> <hr/>
<h4>{sparkProperties.size} Spark Properties</h4> {sparkPropertyTable} <h4>{sparkProperties.size} Spark Properties</h4>
{sparkPropertyTable}
<hr/> <hr/>
<h4>{otherProperties.size} System Properties</h4> {otherPropertyTable} <h4>{otherProperties.size} System Properties</h4>
{otherPropertyTable}
<hr/> <hr/>
<h4>{classPath.size} Classpath Entries</h4> {classPathTable} <h4>{classPath.size} Classpath Entries</h4>
{classPathTable}
</span> </span>
UIUtils.headerSparkPage(content, sc, "Environment", Environment) UIUtils.headerSparkPage(content, sc, "Environment", Environment)
......
...@@ -21,7 +21,7 @@ private[spark] class PoolTable(pools: Seq[Schedulable], listener: JobProgressLis ...@@ -21,7 +21,7 @@ private[spark] class PoolTable(pools: Seq[Schedulable], listener: JobProgressLis
private def poolTable(makeRow: (Schedulable, HashMap[String, HashSet[Stage]]) => Seq[Node], private def poolTable(makeRow: (Schedulable, HashMap[String, HashSet[Stage]]) => Seq[Node],
rows: Seq[Schedulable] rows: Seq[Schedulable]
): Seq[Node] = { ): Seq[Node] = {
<table class="table table-bordered table-striped table-condensed sortable"> <table class="table table-bordered table-striped table-condensed sortable table-fixed">
<thead> <thead>
<th>Pool Name</th> <th>Pool Name</th>
<th>Minimum Share</th> <th>Minimum Share</th>
......
...@@ -123,16 +123,16 @@ private[spark] class StagePage(parent: JobProgressUI) { ...@@ -123,16 +123,16 @@ private[spark] class StagePage(parent: JobProgressUI) {
if (hasShuffleRead) shuffleReadQuantiles else Nil, if (hasShuffleRead) shuffleReadQuantiles else Nil,
if (hasShuffleWrite) shuffleWriteQuantiles else Nil) if (hasShuffleWrite) shuffleWriteQuantiles else Nil)
val quantileHeaders = Seq("Metric", "Min (0th percentitle)", "25th percentile", val quantileHeaders = Seq("Metric", "Min", "25th percentile",
"50th percentile", "75th percentile", "Max (100th percentile)") "Median", "75th percentile", "Max")
def quantileRow(data: Seq[String]): Seq[Node] = <tr> {data.map(d => <td>{d}</td>)} </tr> def quantileRow(data: Seq[String]): Seq[Node] = <tr> {data.map(d => <td>{d}</td>)} </tr>
Some(listingTable(quantileHeaders, quantileRow, listings)) Some(listingTable(quantileHeaders, quantileRow, listings, fixedWidth = true))
} }
val content = val content =
summary ++ summary ++
<h4>Summary Metrics for {numCompleted} Completed Tasks</h4> ++ <h4>Summary Metrics for {numCompleted} Completed Tasks</h4> ++
<div>{summaryTable.getOrElse("No tasks have reported their execution metrics yet.")}</div> ++ <div>{summaryTable.getOrElse("No tasks have reported metrics yet.")}</div> ++
<hr/><h4>Tasks</h4> ++ taskTable; <hr/><h4>Tasks</h4> ++ taskTable;
headerSparkPage(content, parent.sc, "Details for Stage %d".format(stageId), Jobs) headerSparkPage(content, parent.sc, "Details for Stage %d".format(stageId), Jobs)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment