Skip to content

Commit 43dcbe3

Browse files
committed
Some updates to DAG
1 parent fac734a commit 43dcbe3

File tree

3 files changed

+67
-39
lines changed

3 files changed

+67
-39
lines changed

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

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,68 +16,88 @@
1616
*/
1717

1818
#dag-viz-graph svg path {
19-
stroke: #444444;
19+
stroke: #444;
2020
stroke-width: 1.5px;
2121
}
2222

2323
#dag-viz-graph svg g.cluster rect {
24-
stroke-width: 4px;
25-
stroke-opacity: 0.5;
24+
stroke-width: 1px;
25+
}
26+
27+
#dag-viz-graph svg g.node circle {
28+
fill: #444;
2629
}
2730

28-
#dag-viz-graph svg g.node circle,
2931
#dag-viz-graph svg g.node rect {
30-
fill: #444444;
32+
fill: #C3EBFF;
33+
stroke: #3EC0FF;
34+
stroke-width: 1px;
35+
}
36+
37+
#dag-viz-graph svg g.node.cached circle {
38+
fill: #444;
3139
}
3240

33-
#dag-viz-graph svg g.node.cached circle,
3441
#dag-viz-graph svg g.node.cached rect {
35-
fill: #FF0000;
42+
fill: #b3f5c5;
43+
stroke: #56f578;
44+
stroke-width: 1px;
3645
}
3746

3847
/* Job page specific styles */
3948

4049
#dag-viz-graph svg.job marker#marker-arrow path {
41-
fill: #444444;
50+
fill: #333;
4251
stroke-width: 0px;
4352
}
4453

4554
#dag-viz-graph svg.job g.cluster rect {
46-
fill: #FFFFFF;
47-
stroke: #AADFFF;
55+
fill: #A0DFFF;
56+
stroke: #3EC0FF;
57+
stroke-width: 1px;
4858
}
4959

5060
#dag-viz-graph svg.job g.cluster[id*="stage"] rect {
51-
stroke: #FFDDEE;
52-
stroke-width: 6px;
61+
fill: #FFFFFF;
62+
stroke: #ff99ac;
63+
stroke-width: 1px;
5364
}
5465

5566
#dag-viz-graph svg.job g#cross-stage-edges path {
5667
fill: none;
5768
}
5869

5970
#dag-viz-graph svg.job g.cluster text {
60-
fill: #AAAAAA;
71+
fill: #333;
6172
}
6273

6374
/* Stage page specific styles */
6475

6576
#dag-viz-graph svg.stage g.cluster rect {
66-
fill: #F0F8FF;
67-
stroke: #AADFFF;
77+
fill: #A0DFFF;
78+
stroke: #3EC0FF;
79+
stroke-width: 1px;
6880
}
6981

7082
#dag-viz-graph svg.stage g.cluster[id*="stage"] rect {
7183
fill: #FFFFFF;
72-
stroke: #FFDDEE;
73-
stroke-width: 6px;
84+
stroke: #ffa6b6;
85+
stroke-width: 1px;
7486
}
7587

7688
#dag-viz-graph svg.stage g.node g.label text tspan {
77-
fill: #FFFFFF;
89+
fill: #333;
7890
}
7991

8092
#dag-viz-graph svg.stage g.cluster text {
81-
fill: #444444;
82-
font-weight: bold;
93+
fill: #333;
94+
}
95+
96+
#dag-viz-graph a, #dag-viz-graph a:hover {
97+
text-decoration: none;
98+
}
99+
100+
#dag-viz-graph .label {
101+
font-weight: normal;
102+
text-shadow: none;
83103
}

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

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@
5252
*/
5353

5454
var VizConstants = {
55-
svgMarginX: 20,
56-
svgMarginY: 20,
55+
svgMarginX: 16,
56+
svgMarginY: 16,
5757
stageSep: 50,
5858
graphPrefix: "graph_",
5959
nodePrefix: "node_",
@@ -63,14 +63,14 @@ var VizConstants = {
6363
};
6464

6565
var JobPageVizConstants = {
66-
clusterLabelSize: 11,
66+
clusterLabelSize: 12,
6767
stageClusterLabelSize: 14
68-
}
68+
};
6969

7070
var StagePageVizConstants = {
7171
clusterLabelSize: 14,
72-
stageClusterLabelSize: 18
73-
}
72+
stageClusterLabelSize: 14
73+
};
7474

7575
/*
7676
* Show or hide the RDD DAG visualization.
@@ -151,9 +151,9 @@ function renderDagVizForStage(svgContainer) {
151151
var container = svgContainer.append("g").attr("id", containerId);
152152
renderDot(dot, container);
153153

154-
// Round corners on RDDs
154+
// Round corners on rectangles
155155
svgContainer
156-
.selectAll("g.node rect")
156+
.selectAll("rect")
157157
.attr("rx", "5")
158158
.attr("ry", "5");
159159
}
@@ -209,6 +209,12 @@ function renderDagVizForJob(svgContainer) {
209209
// Actually render the stage
210210
renderDot(dot, container);
211211

212+
// Round corners on rectangles
213+
container
214+
.selectAll("rect")
215+
.attr("rx", "4")
216+
.attr("ry", "4");
217+
212218
// If there are any incoming edges into this graph, keep track of them to render
213219
// them separately later. Note that we cannot draw them now because we need to
214220
// put these edges in a separate container that is on top of all stage graphs.
@@ -248,12 +254,13 @@ function metadataContainer() { return d3.select("#dag-viz-metadata"); }
248254
* In general, the clustering support for dagre-d3 is quite limited at this point.
249255
*/
250256
function drawClusterLabels(svgContainer, forJob) {
257+
var clusterLabelSize, stageClusterLabelSize;
251258
if (forJob) {
252-
var clusterLabelSize = JobPageVizConstants.clusterLabelSize;
253-
var stageClusterLabelSize = JobPageVizConstants.stageClusterLabelSize;
259+
clusterLabelSize = JobPageVizConstants.clusterLabelSize;
260+
stageClusterLabelSize = JobPageVizConstants.stageClusterLabelSize;
254261
} else {
255-
var clusterLabelSize = StagePageVizConstants.clusterLabelSize;
256-
var stageClusterLabelSize = StagePageVizConstants.stageClusterLabelSize;
262+
clusterLabelSize = StagePageVizConstants.clusterLabelSize;
263+
stageClusterLabelSize = StagePageVizConstants.stageClusterLabelSize;
257264
}
258265
svgContainer.selectAll("g.cluster").each(function() {
259266
var cluster = d3.select(this);
@@ -283,7 +290,7 @@ function drawClusterLabel(d3cluster, fontSize) {
283290
.attr("x", labelX)
284291
.attr("y", labelY)
285292
.attr("text-anchor", "end")
286-
.style("font-size", fontSize)
293+
.style("font-size", fontSize + "px")
287294
.text(labelText);
288295
}
289296

@@ -303,12 +310,12 @@ function resizeSvg(svg) {
303310
}));
304311
var endX = VizConstants.svgMarginX +
305312
toFloat(d3.max(allClusters, function(e) {
306-
var t = d3.select(e)
313+
var t = d3.select(e);
307314
return getAbsolutePosition(t).x + toFloat(t.attr("width"));
308315
}));
309316
var endY = VizConstants.svgMarginY +
310317
toFloat(d3.max(allClusters, function(e) {
311-
var t = d3.select(e)
318+
var t = d3.select(e);
312319
return getAbsolutePosition(t).y + toFloat(t.attr("height"));
313320
}));
314321
var width = endX - startX;
@@ -338,7 +345,7 @@ function drawCrossStageEdges(edges, svgContainer) {
338345
if (!dagreD3Marker.empty()) {
339346
svgContainer
340347
.append(function() { return dagreD3Marker.node().cloneNode(true); })
341-
.attr("id", "marker-arrow")
348+
.attr("id", "marker-arrow");
342349
svgContainer.selectAll("g > path").attr("marker-end", "url(#marker-arrow)");
343350
svgContainer.selectAll("g.edgePaths def").remove(); // We no longer need these
344351
}
@@ -394,12 +401,13 @@ function connectRDDs(fromRDDId, toRDDId, edgesContainer, svgContainer) {
394401
toPos.x += delta;
395402
}
396403

404+
var points;
397405
if (fromPos.y == toPos.y) {
398406
// If they are on the same rank, curve the middle part of the edge
399407
// upward a little to avoid interference with things in between
400408
// e.g. _______
401409
// _____/ \_____
402-
var points = [
410+
points = [
403411
[fromPos.x, fromPos.y],
404412
[fromPos.x + (toPos.x - fromPos.x) * 0.2, fromPos.y],
405413
[fromPos.x + (toPos.x - fromPos.x) * 0.3, fromPos.y - 20],
@@ -413,7 +421,7 @@ function connectRDDs(fromRDDId, toRDDId, edgesContainer, svgContainer) {
413421
// /
414422
// |
415423
// _____/
416-
var points = [
424+
points = [
417425
[fromPos.x, fromPos.y],
418426
[fromPos.x + (toPos.x - fromPos.x) * 0.4, fromPos.y],
419427
[fromPos.x + (toPos.x - fromPos.x) * 0.6, toPos.y],

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ private[ui] object RDDOperationGraph extends Logging {
182182
if (forJob) {
183183
s"""${node.id} [label="$label" shape="circle" padding="5" labelStyle="font-size: 0"]"""
184184
} else {
185-
s"""${node.id} [label="$label" padding="5" labelStyle="font-size: 10"]"""
185+
s"""${node.id} [label="$label" padding="5" labelStyle="font-size: 12px"]"""
186186
}
187187
}
188188

0 commit comments

Comments
 (0)