diff options
author | Carson Wang <carson.wang@intel.com> | 2015-08-11 23:25:02 -0700 |
---|---|---|
committer | Andrew Or <andrew@databricks.com> | 2015-08-11 23:25:02 -0700 |
commit | bab89232854de7554e88f29cab76f1a1c349edc1 (patch) | |
tree | 202a6c8d91c2beb7e890cb01ed694b274d3950bf /core/src/main | |
parent | 4e3f4b934f74e8c7c06f4940d6381343f9fd4918 (diff) | |
download | spark-bab89232854de7554e88f29cab76f1a1c349edc1.tar.gz spark-bab89232854de7554e88f29cab76f1a1c349edc1.tar.bz2 spark-bab89232854de7554e88f29cab76f1a1c349edc1.zip |
[SPARK-9426] [WEBUI] Job page DAG visualization is not shown
To reproduce the issue, go to the stage page and click DAG Visualization once, then go to the job page to show the job DAG visualization. You will only see the first stage of the job.
Root cause: the java script use local storage to remember your selection. Once you click the stage DAG visualization, the local storage set `expand-dag-viz-arrow-stage` to true. When you go to the job page, the js checks `expand-dag-viz-arrow-stage` in the local storage first and will try to show stage DAG visualization on the job page.
To fix this, I set an id to the DAG span to differ job page and stage page. In the js code, we check the id and local storage together to make sure we show the correct DAG visualization.
Author: Carson Wang <carson.wang@intel.com>
Closes #8104 from carsonwang/SPARK-9426.
Diffstat (limited to 'core/src/main')
-rw-r--r-- | core/src/main/resources/org/apache/spark/ui/static/spark-dag-viz.js | 8 | ||||
-rw-r--r-- | core/src/main/scala/org/apache/spark/ui/UIUtils.scala | 3 |
2 files changed, 6 insertions, 5 deletions
diff --git a/core/src/main/resources/org/apache/spark/ui/static/spark-dag-viz.js b/core/src/main/resources/org/apache/spark/ui/static/spark-dag-viz.js index 4a893bc018..83dbea40b6 100644 --- a/core/src/main/resources/org/apache/spark/ui/static/spark-dag-viz.js +++ b/core/src/main/resources/org/apache/spark/ui/static/spark-dag-viz.js @@ -109,13 +109,13 @@ function toggleDagViz(forJob) { } $(function (){ - if (window.localStorage.getItem(expandDagVizArrowKey(false)) == "true") { + if ($("#stage-dag-viz").length && + window.localStorage.getItem(expandDagVizArrowKey(false)) == "true") { // Set it to false so that the click function can revert it window.localStorage.setItem(expandDagVizArrowKey(false), "false"); toggleDagViz(false); - } - - if (window.localStorage.getItem(expandDagVizArrowKey(true)) == "true") { + } else if ($("#job-dag-viz").length && + window.localStorage.getItem(expandDagVizArrowKey(true)) == "true") { // Set it to false so that the click function can revert it window.localStorage.setItem(expandDagVizArrowKey(true), "false"); toggleDagViz(true); 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 718aea7e1d..f2da417724 100644 --- a/core/src/main/scala/org/apache/spark/ui/UIUtils.scala +++ b/core/src/main/scala/org/apache/spark/ui/UIUtils.scala @@ -352,7 +352,8 @@ private[spark] object UIUtils extends Logging { */ private def showDagViz(graphs: Seq[RDDOperationGraph], forJob: Boolean): Seq[Node] = { <div> - <span class="expand-dag-viz" onclick={s"toggleDagViz($forJob);"}> + <span id={if (forJob) "job-dag-viz" else "stage-dag-viz"} + class="expand-dag-viz" onclick={s"toggleDagViz($forJob);"}> <span class="expand-dag-viz-arrow arrow-closed"></span> <a data-toggle="tooltip" title={if (forJob) ToolTips.JOB_DAG else ToolTips.STAGE_DAG} data-placement="right"> |