Skip to content
Snippets Groups Projects
Commit bab89232 authored by Carson Wang's avatar Carson Wang Committed by Andrew Or
Browse files

[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.
parent 4e3f4b93
No related branches found
No related tags found
No related merge requests found
...@@ -109,13 +109,13 @@ function toggleDagViz(forJob) { ...@@ -109,13 +109,13 @@ function toggleDagViz(forJob) {
} }
$(function (){ $(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 // Set it to false so that the click function can revert it
window.localStorage.setItem(expandDagVizArrowKey(false), "false"); window.localStorage.setItem(expandDagVizArrowKey(false), "false");
toggleDagViz(false); toggleDagViz(false);
} } else if ($("#job-dag-viz").length &&
window.localStorage.getItem(expandDagVizArrowKey(true)) == "true") {
if (window.localStorage.getItem(expandDagVizArrowKey(true)) == "true") {
// Set it to false so that the click function can revert it // Set it to false so that the click function can revert it
window.localStorage.setItem(expandDagVizArrowKey(true), "false"); window.localStorage.setItem(expandDagVizArrowKey(true), "false");
toggleDagViz(true); toggleDagViz(true);
......
...@@ -352,7 +352,8 @@ private[spark] object UIUtils extends Logging { ...@@ -352,7 +352,8 @@ private[spark] object UIUtils extends Logging {
*/ */
private def showDagViz(graphs: Seq[RDDOperationGraph], forJob: Boolean): Seq[Node] = { private def showDagViz(graphs: Seq[RDDOperationGraph], forJob: Boolean): Seq[Node] = {
<div> <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> <span class="expand-dag-viz-arrow arrow-closed"></span>
<a data-toggle="tooltip" title={if (forJob) ToolTips.JOB_DAG else ToolTips.STAGE_DAG} <a data-toggle="tooltip" title={if (forJob) ToolTips.JOB_DAG else ToolTips.STAGE_DAG}
data-placement="right"> data-placement="right">
......
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