aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Bozarth <ajbozart@us.ibm.com>2016-06-25 09:27:22 +0100
committerSean Owen <sowen@cloudera.com>2016-06-25 09:27:22 +0100
commit3ee9695d1fcf3750cbf7896a56f8a1ba93f4e82f (patch)
treedd5a086dae0de4f6b0107d067f257485257243cd
parentbf665a958631125a1670504ef5966ef1a0e14798 (diff)
downloadspark-3ee9695d1fcf3750cbf7896a56f8a1ba93f4e82f.tar.gz
spark-3ee9695d1fcf3750cbf7896a56f8a1ba93f4e82f.tar.bz2
spark-3ee9695d1fcf3750cbf7896a56f8a1ba93f4e82f.zip
[SPARK-1301][WEB UI] Added anchor links to Accumulators and Tasks on StagePage
## What changes were proposed in this pull request? Sometimes the "Aggregated Metrics by Executor" table on the Stage page can get very long so actor links to the Accumulators and Tasks tables below it have been added to the summary at the top of the page. This has been done in the same way as the Jobs and Stages pages. Note: the Accumulators link only displays when the table exists. ## How was this patch tested? Manually Tested and dev/run-tests ![justtasks](https://cloud.githubusercontent.com/assets/13952758/15165269/6e8efe8c-16c9-11e6-9784-cffe966fdcf0.png) ![withaccumulators](https://cloud.githubusercontent.com/assets/13952758/15165270/7019ec9e-16c9-11e6-8649-db69ed7a317d.png) Author: Alex Bozarth <ajbozart@us.ibm.com> Closes #13037 from ajbozarth/spark1301.
-rw-r--r--core/src/main/resources/org/apache/spark/ui/static/webui.css4
-rw-r--r--core/src/main/resources/org/apache/spark/ui/static/webui.js47
-rw-r--r--core/src/main/scala/org/apache/spark/ui/UIUtils.scala1
-rw-r--r--core/src/main/scala/org/apache/spark/ui/jobs/StagePage.scala16
4 files changed, 64 insertions, 4 deletions
diff --git a/core/src/main/resources/org/apache/spark/ui/static/webui.css b/core/src/main/resources/org/apache/spark/ui/static/webui.css
index 595e80ab5e..b157f3e0a4 100644
--- a/core/src/main/resources/org/apache/spark/ui/static/webui.css
+++ b/core/src/main/resources/org/apache/spark/ui/static/webui.css
@@ -155,7 +155,7 @@ pre {
display: none;
}
-span.expand-additional-metrics, span.expand-dag-viz {
+span.expand-additional-metrics, span.expand-dag-viz, span.collapse-table {
cursor: pointer;
}
@@ -163,7 +163,7 @@ span.additional-metric-title {
cursor: pointer;
}
-.additional-metrics.collapsed {
+.additional-metrics.collapsed, .collapsible-table.collapsed {
display: none;
}
diff --git a/core/src/main/resources/org/apache/spark/ui/static/webui.js b/core/src/main/resources/org/apache/spark/ui/static/webui.js
new file mode 100644
index 0000000000..e37307aa1f
--- /dev/null
+++ b/core/src/main/resources/org/apache/spark/ui/static/webui.js
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+function collapseTablePageLoad(name, table){
+ if (window.localStorage.getItem(name) == "true") {
+ // Set it to false so that the click function can revert it
+ window.localStorage.setItem(name, "false");
+ collapseTable(name, table);
+ }
+}
+
+function collapseTable(thisName, table){
+ var status = window.localStorage.getItem(thisName) == "true";
+ status = !status;
+
+ thisClass = '.' + thisName
+
+ // Expand the list of additional metrics.
+ var tableDiv = $(thisClass).parent().find('.' + table);
+ $(tableDiv).toggleClass('collapsed');
+
+ // Switch the class of the arrow from open to closed.
+ $(thisClass).find('.collapse-table-arrow').toggleClass('arrow-open');
+ $(thisClass).find('.collapse-table-arrow').toggleClass('arrow-closed');
+
+ window.localStorage.setItem(thisName, "" + status);
+}
+
+// Add a call to collapseTablePageLoad() on each collapsible table
+// to remember if it's collapsed on each page reload
+$(function() {
+ collapseTablePageLoad('collapse-aggregated-metrics','aggregated-metrics');
+}); \ No newline at end of file
diff --git a/core/src/main/scala/org/apache/spark/ui/UIUtils.scala b/core/src/main/scala/org/apache/spark/ui/UIUtils.scala
index 4e2fe5e0e5..740f5e5f7f 100644
--- a/core/src/main/scala/org/apache/spark/ui/UIUtils.scala
+++ b/core/src/main/scala/org/apache/spark/ui/UIUtils.scala
@@ -169,6 +169,7 @@ private[spark] object UIUtils extends Logging {
<script src={prependBaseUri("/static/additional-metrics.js")}></script>
<script src={prependBaseUri("/static/timeline-view.js")}></script>
<script src={prependBaseUri("/static/log-view.js")}></script>
+ <script src={prependBaseUri("/static/webui.js")}></script>
}
def vizHeaderNodes: Seq[Node] = {
diff --git a/core/src/main/scala/org/apache/spark/ui/jobs/StagePage.scala b/core/src/main/scala/org/apache/spark/ui/jobs/StagePage.scala
index d986a55959..a5e2a20689 100644
--- a/core/src/main/scala/org/apache/spark/ui/jobs/StagePage.scala
+++ b/core/src/main/scala/org/apache/spark/ui/jobs/StagePage.scala
@@ -564,6 +564,18 @@ private[ui] class StagePage(parent: StagesTab) extends WebUIPage("stage") {
val maybeAccumulableTable: Seq[Node] =
if (hasAccumulators) { <h4>Accumulators</h4> ++ accumulableTable } else Seq()
+ val aggMetrics =
+ <span class="collapse-aggregated-metrics collapse-table"
+ onClick="collapseTable('collapse-aggregated-metrics','aggregated-metrics')">
+ <h4>
+ <span class="collapse-table-arrow arrow-open"></span>
+ <a>Aggregated Metrics by Executor</a>
+ </h4>
+ </span>
+ <div class="aggregated-metrics collapsible-table">
+ {executorTable.toNodeSeq}
+ </div>
+
val content =
summary ++
dagViz ++
@@ -572,9 +584,9 @@ private[ui] class StagePage(parent: StagesTab) extends WebUIPage("stage") {
// Only show the tasks in the table
stageData.taskData.values.toSeq.filter(t => taskIdsInPage.contains(t.taskInfo.taskId)),
currentTime) ++
- <h4>Summary Metrics for {numCompleted} Completed Tasks</h4> ++
+ <h4>Summary Metrics for <a href="#tasks-section">{numCompleted} Completed Tasks</a></h4> ++
<div>{summaryTable.getOrElse("No tasks have reported metrics yet.")}</div> ++
- <h4>Aggregated Metrics by Executor</h4> ++ executorTable.toNodeSeq ++
+ aggMetrics ++
maybeAccumulableTable ++
<h4 id="tasks-section">Tasks</h4> ++ taskTableHTML ++ jsForScrollingDownToTaskTable
UIUtils.headerSparkPage(stageHeader, content, parent, showVisualization = true)