Skip to content

Commit 1b742a4

Browse files
author
Andrew Or
committed
[SPARK-7347] DAG visualization: add tooltips to RDDs
This is an addition to #5729. Here's an example with ALS. <img src="https://issues.apache.org/jira/secure/attachment/12731039/tooltip.png" width="400px"></img> Author: Andrew Or <[email protected]> Closes #5957 from andrewor14/viz-hover2 and squashes the following commits: 60e3758 [Andrew Or] Add tooltips for RDDs on job page (cherry picked from commit 88717ee) Signed-off-by: Andrew Or <[email protected]>
1 parent 800c0fc commit 1b742a4

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

core/src/main/resources/org/apache/spark/ui/static/spark-dag-viz.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ function renderDagVizForJob(svgContainer) {
218218
});
219219
});
220220

221+
addTooltipsForRDDs(svgContainer);
221222
drawCrossStageEdges(crossStageEdges, svgContainer);
222223
}
223224

@@ -424,6 +425,21 @@ function connectRDDs(fromRDDId, toRDDId, edgesContainer, svgContainer) {
424425
edgesContainer.append("path").datum(points).attr("d", line);
425426
}
426427

428+
/* (Job page only) Helper function to add tooltips for RDDs. */
429+
function addTooltipsForRDDs(svgContainer) {
430+
svgContainer.selectAll("g.node").each(function() {
431+
var node = d3.select(this);
432+
var tooltipText = node.attr("name");
433+
if (tooltipText) {
434+
node.select("circle")
435+
.attr("data-toggle", "tooltip")
436+
.attr("data-placement", "right")
437+
.attr("title", tooltipText)
438+
}
439+
});
440+
$("[data-toggle=tooltip]").tooltip({container: "body"});
441+
}
442+
427443
/* Helper function to convert attributes to numeric values. */
428444
function toFloat(f) {
429445
if (f) {

core/src/main/scala/org/apache/spark/ui/scope/RDDOperationGraph.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,11 @@ private[ui] object RDDOperationGraph extends Logging {
178178
* On the stage page, it is displayed as a box with an embedded label.
179179
*/
180180
private def makeDotNode(node: RDDOperationNode, forJob: Boolean): String = {
181+
val label = s"${node.name} (${node.id})"
181182
if (forJob) {
182-
s"""${node.id} [label=" " shape="circle" padding="5" labelStyle="font-size: 0"]"""
183+
s"""${node.id} [label="$label" shape="circle" padding="5" labelStyle="font-size: 0"]"""
183184
} else {
184-
s"""${node.id} [label="${node.name} (${node.id})" padding="5" labelStyle="font-size: 10"]"""
185+
s"""${node.id} [label="$label" padding="5" labelStyle="font-size: 10"]"""
185186
}
186187
}
187188

0 commit comments

Comments
 (0)