Skip to content

Commit 61baf10

Browse files
author
Andrew Or
committed
Add RDD callsite to DAG visualization
1 parent 2401599 commit 61baf10

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,7 @@
122122
stroke: #52C366;
123123
stroke-width: 2px;
124124
}
125+
126+
.tooltip-inner {
127+
white-space: pre-wrap;
128+
}

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ private[ui] case class RDDOperationGraph(
3939
rootCluster: RDDOperationCluster)
4040

4141
/** A node in an RDDOperationGraph. This represents an RDD. */
42-
private[ui] case class RDDOperationNode(id: Int, name: String, cached: Boolean)//, callsite: CallSite)
42+
private[ui] case class RDDOperationNode(id: Int, name: String, cached: Boolean, callsite: CallSite)
4343

4444
/**
4545
* A directed edge connecting two nodes in an RDDOperationGraph.
@@ -105,8 +105,8 @@ private[ui] object RDDOperationGraph extends Logging {
105105
edges ++= rdd.parentIds.map { parentId => RDDOperationEdge(parentId, rdd.id) }
106106

107107
// TODO: differentiate between the intention to cache an RDD and whether it's actually cached
108-
val node = nodes.getOrElseUpdate(
109-
rdd.id, RDDOperationNode(rdd.id, rdd.name, rdd.storageLevel != StorageLevel.NONE))
108+
val node = nodes.getOrElseUpdate(rdd.id, RDDOperationNode(
109+
rdd.id, rdd.name, rdd.storageLevel != StorageLevel.NONE, rdd.callSite))
110110

111111
if (rdd.scope.isEmpty) {
112112
// This RDD has no encompassing scope, so we put it directly in the root cluster
@@ -178,7 +178,8 @@ private[ui] object RDDOperationGraph extends Logging {
178178

179179
/** Return the dot representation of a node in an RDDOperationGraph. */
180180
private def makeDotNode(node: RDDOperationNode): String = {
181-
s"""${node.id} [label="${node.name} [${node.id}]"]"""
181+
val label = s"${node.name} [${node.id}]\n${node.callsite.shortForm}"
182+
s"""${node.id} [label="$label"]"""
182183
}
183184

184185
/** Update the dot representation of the RDDOperationGraph in cluster to subgraph. */

0 commit comments

Comments
 (0)