diff options
author | Alex Bozarth <ajbozart@us.ibm.com> | 2016-06-16 14:29:11 -0700 |
---|---|---|
committer | Andrew Or <andrew@databricks.com> | 2016-06-16 14:29:11 -0700 |
commit | e849285df03b1233d5f647f1b6c5a6dad0665855 (patch) | |
tree | 1ba507355a454fe03d6809ae434e3f3894f218ff /core/src | |
parent | 2d27eb1e753daefbd311136fc7de1a3e8fb9dc63 (diff) | |
download | spark-e849285df03b1233d5f647f1b6c5a6dad0665855.tar.gz spark-e849285df03b1233d5f647f1b6c5a6dad0665855.tar.bz2 spark-e849285df03b1233d5f647f1b6c5a6dad0665855.zip |
[SPARK-15868][WEB UI] Executors table in Executors tab should sort Executor IDs in numerical order
## What changes were proposed in this pull request?
Currently the Executors table sorts by id using a string sort (since that's what it is stored as). Since the id is a number (other than the driver) we should be sorting numerically. I have changed both the initial sort on page load as well as the table sort to sort on id numerically, treating non-numeric strings (like the driver) as "-1"
## How was this patch tested?
Manually tested and dev/run-tests
![pageload](https://cloud.githubusercontent.com/assets/13952758/16027882/d32edd0a-318e-11e6-9faf-fc972b7c36ab.png)
![sorted](https://cloud.githubusercontent.com/assets/13952758/16027883/d34541c6-318e-11e6-9ed7-6bfc0cd4152e.png)
Author: Alex Bozarth <ajbozart@us.ibm.com>
Closes #13654 from ajbozarth/spark15868.
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/main/scala/org/apache/spark/ui/exec/ExecutorsPage.scala | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/core/src/main/scala/org/apache/spark/ui/exec/ExecutorsPage.scala b/core/src/main/scala/org/apache/spark/ui/exec/ExecutorsPage.scala index 791dbe5c27..67deb7b14b 100644 --- a/core/src/main/scala/org/apache/spark/ui/exec/ExecutorsPage.scala +++ b/core/src/main/scala/org/apache/spark/ui/exec/ExecutorsPage.scala @@ -20,6 +20,7 @@ package org.apache.spark.ui.exec import java.net.URLEncoder import javax.servlet.http.HttpServletRequest +import scala.util.Try import scala.xml.Node import org.apache.spark.status.api.v1.ExecutorSummary @@ -53,6 +54,9 @@ private[ui] class ExecutorsPage( // When GCTimePercent is edited change ToolTips.TASK_TIME to match private val GCTimePercent = 0.1 + // a safe String to Int for sorting ids (converts non-numeric Strings to -1) + private def idStrToInt(str: String) : Int = Try(str.toInt).getOrElse(-1) + def render(request: HttpServletRequest): Seq[Node] = { val (activeExecutorInfo, deadExecutorInfo) = listener.synchronized { // The follow codes should be protected by `listener` to make sure no executors will be @@ -69,13 +73,14 @@ private[ui] class ExecutorsPage( } val execInfo = activeExecutorInfo ++ deadExecutorInfo + implicit val idOrder = Ordering[Int].on((s: String) => idStrToInt(s)).reverse val execInfoSorted = execInfo.sortBy(_.id) val logsExist = execInfo.filter(_.executorLogs.nonEmpty).nonEmpty val execTable = { <table class={UIUtils.TABLE_CLASS_STRIPED_SORTABLE}> <thead> - <th>Executor ID</th> + <th class="sorttable_numeric">Executor ID</th> <th>Address</th> <th>Status</th> <th>RDD Blocks</th> @@ -136,7 +141,7 @@ private[ui] class ExecutorsPage( } <tr> - <td>{info.id}</td> + <td sorttable_customkey={idStrToInt(info.id).toString}>{info.id}</td> <td>{info.hostPort}</td> <td sorttable_customkey={executorStatus.toString}> {executorStatus} |