Repository: spark Updated Branches: refs/heads/master 35316cb0b -> dc6c5ea4c
[SPARK-13468][WEB UI] Fix a corner case where the Stage UI page should show DAG but it doesn't show When uses clicks more than one time on any stage in the DAG graph on the *Job* web UI page, many new *Stage* web UI pages are opened, but only half of their DAG graphs are expanded. After this PR's fix, every newly opened *Stage* page's DAG graph is expanded. Before: ![](https://cloud.githubusercontent.com/assets/15843379/13279144/74808e86-db10-11e5-8514-cecf31af8908.png) After: ![](https://cloud.githubusercontent.com/assets/15843379/13279145/77ca5dec-db10-11e5-9457-8e1985461328.png) ## What changes were proposed in this pull request? - Removed the `expandDagViz` parameter for _Stage_ page and related codes - Added a `onclick` function setting `expandDagVizArrowKey(false)` as `true` ## How was this patch tested? Manual tests (with this fix) to verified this fix work: - clicked many times on _Job_ Page's DAG Graph â each newly opened Stage page's DAG graph is expanded Manual tests (with this fix) to verified this fix do not break features we already had: - refreshed many times for a same _Stage_ page (whose DAG already expanded) â DAG remained expanded upon every refresh - refreshed many times for a same _Stage_ page (whose DAG unexpanded) â DAG remained unexpanded upon every refresh - refreshed many times for a same _Job_ page (whose DAG already expanded) â DAG remained expanded upon every refresh - refreshed many times for a same _Job_ page (whose DAG unexpanded) â DAG remained unexpanded upon every refresh Author: Liwei Lin <proflin...@gmail.com> Closes #11368 from proflin/SPARK-13468. Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/dc6c5ea4 Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/dc6c5ea4 Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/dc6c5ea4 Branch: refs/heads/master Commit: dc6c5ea4c91c387deb87764c86c4f40ea71657b7 Parents: 35316cb Author: Liwei Lin <proflin...@gmail.com> Authored: Thu Feb 25 15:36:25 2016 -0800 Committer: Shixiong Zhu <shixi...@databricks.com> Committed: Thu Feb 25 15:36:25 2016 -0800 ---------------------------------------------------------------------- .../org/apache/spark/ui/static/spark-dag-viz.js | 3 ++- core/src/main/scala/org/apache/spark/ui/UIUtils.scala | 7 ------- .../main/scala/org/apache/spark/ui/jobs/StagePage.scala | 12 ------------ 3 files changed, 2 insertions(+), 20 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/spark/blob/dc6c5ea4/core/src/main/resources/org/apache/spark/ui/static/spark-dag-viz.js ---------------------------------------------------------------------- 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 4337c42..1b0d469 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 @@ -222,10 +222,11 @@ function renderDagVizForJob(svgContainer) { var attemptId = 0 var stageLink = d3.select("#stage-" + stageId + "-" + attemptId) .select("a.name-link") - .attr("href") + "&expandDagViz=true"; + .attr("href"); container = svgContainer .append("a") .attr("xlink:href", stageLink) + .attr("onclick", "window.localStorage.setItem(expandDagVizArrowKey(false), true)") .append("g") .attr("id", containerId); } http://git-wip-us.apache.org/repos/asf/spark/blob/dc6c5ea4/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 ddd7f71..0493513 100644 --- a/core/src/main/scala/org/apache/spark/ui/UIUtils.scala +++ b/core/src/main/scala/org/apache/spark/ui/UIUtils.scala @@ -408,13 +408,6 @@ private[spark] object UIUtils extends Logging { </sup> } - /** Return a script element that automatically expands the DAG visualization on page load. */ - def expandDagVizOnLoad(forJob: Boolean): Seq[Node] = { - <script type="text/javascript"> - {Unparsed("$(document).ready(function() { toggleDagViz(" + forJob + ") });")} - </script> - } - /** * Returns HTML rendering of a job or stage description. It will try to parse the string as HTML * and make sure that it only contains anchors with root-relative links. Otherwise, http://git-wip-us.apache.org/repos/asf/spark/blob/dc6c5ea4/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 0b68b88..689ab7d 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 @@ -107,10 +107,6 @@ private[ui] class StagePage(parent: StagesTab) extends WebUIPage("stage") { val taskPageSize = Option(parameterTaskPageSize).map(_.toInt).getOrElse(100) val taskPrevPageSize = Option(parameterTaskPrevPageSize).map(_.toInt).getOrElse(taskPageSize) - // If this is set, expand the dag visualization by default - val expandDagVizParam = request.getParameter("expandDagViz") - val expandDagViz = expandDagVizParam != null && expandDagVizParam.toBoolean - val stageId = parameterId.toInt val stageAttemptId = parameterAttempt.toInt val stageDataOption = progressListener.stageIdToData.get((stageId, stageAttemptId)) @@ -263,13 +259,6 @@ private[ui] class StagePage(parent: StagesTab) extends WebUIPage("stage") { val dagViz = UIUtils.showDagVizForStage( stageId, operationGraphListener.getOperationGraphForStage(stageId)) - val maybeExpandDagViz: Seq[Node] = - if (expandDagViz) { - UIUtils.expandDagVizOnLoad(forJob = false) - } else { - Seq.empty - } - val accumulableHeaders: Seq[String] = Seq("Accumulable", "Value") def accumulableRow(acc: AccumulableInfo): Seq[Node] = { (acc.name, acc.value) match { @@ -578,7 +567,6 @@ private[ui] class StagePage(parent: StagesTab) extends WebUIPage("stage") { val content = summary ++ dagViz ++ - maybeExpandDagViz ++ showAdditionalMetrics ++ makeTimeline( // Only show the tasks in the table --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org