Repository: spark Updated Branches: refs/heads/master bf665a958 -> 3ee9695d1
[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 <ajboz...@us.ibm.com> Closes #13037 from ajbozarth/spark1301. Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/3ee9695d Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/3ee9695d Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/3ee9695d Branch: refs/heads/master Commit: 3ee9695d1fcf3750cbf7896a56f8a1ba93f4e82f Parents: bf665a9 Author: Alex Bozarth <ajboz...@us.ibm.com> Authored: Sat Jun 25 09:27:22 2016 +0100 Committer: Sean Owen <so...@cloudera.com> Committed: Sat Jun 25 09:27:22 2016 +0100 ---------------------------------------------------------------------- .../org/apache/spark/ui/static/webui.css | 4 +- .../org/apache/spark/ui/static/webui.js | 47 ++++++++++++++++++++ .../scala/org/apache/spark/ui/UIUtils.scala | 1 + .../org/apache/spark/ui/jobs/StagePage.scala | 16 ++++++- 4 files changed, 64 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/spark/blob/3ee9695d/core/src/main/resources/org/apache/spark/ui/static/webui.css ---------------------------------------------------------------------- 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 595e80a..b157f3e 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; } http://git-wip-us.apache.org/repos/asf/spark/blob/3ee9695d/core/src/main/resources/org/apache/spark/ui/static/webui.js ---------------------------------------------------------------------- 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 0000000..e37307a --- /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 http://git-wip-us.apache.org/repos/asf/spark/blob/3ee9695d/core/src/main/scala/org/apache/spark/ui/UIUtils.scala ---------------------------------------------------------------------- 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 4e2fe5e..740f5e5 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] = { http://git-wip-us.apache.org/repos/asf/spark/blob/3ee9695d/core/src/main/scala/org/apache/spark/ui/jobs/StagePage.scala ---------------------------------------------------------------------- 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 d986a55..a5e2a20 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) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org