Skip to content

Commit e694b8e

Browse files
committed
Added timeline view to StagePage
1 parent 8f6610c commit e694b8e

File tree

3 files changed

+304
-193
lines changed

3 files changed

+304
-193
lines changed

core/src/main/resources/org/apache/spark/ui/static/timeline-view.css

Lines changed: 53 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ div#application-timeline, div#job-timeline {
3434
height: 80px;
3535
}
3636

37-
#task-assignment-timeline>div.control-panel {
38-
float: left;
39-
}
40-
4137
#task-assignment-timeline>.timeline-header:after {
4238
content: "";
4339
clear: both;
@@ -61,18 +57,61 @@ div#application-timeline, div#job-timeline {
6157
height: 19px;
6258
}
6359

60+
rect.scheduler-delay-proportion {
61+
fill: #F6D76B;
62+
}
63+
64+
rect.deserialization-time-proportion {
65+
fill: #FFBDD8;
66+
}
67+
68+
rect.shuffle-read-time-proportion {
69+
fill: #8AC7DE;
70+
}
71+
72+
rect.executor-runtime-proportion {
73+
fill: #D9EB52;
74+
}
75+
76+
rect.shuffle-write-time-proportion {
77+
fill: #87796F;
78+
}
79+
80+
rect.serialization-time-proportion {
81+
fill: #93DFB8;
82+
}
83+
84+
rect.getting-result-time-proportion {
85+
fill: #FF9036;
86+
}
87+
6488
.vis.timeline .item.task.succeeded {
6589
background-color: #D5DDF6;
6690
}
6791

92+
.legend-area rect.succeeded-task-legend {
93+
fill: #D5DDF6;
94+
stroke: #97B0F8;
95+
}
96+
6897
.vis.timeline .item.task.failed {
6998
background-color: #FF5475;
7099
}
71100

101+
.legend-area rect.failed-task-legend {
102+
fill: #FF5475;
103+
stroke: #97B0F8;
104+
}
105+
72106
.vis.timeline .item.task.running {
73107
background-color: #FDFFCA;
74108
}
75109

110+
.legend-area rect.running-task-legend {
111+
fill: #FDFFCA;
112+
stroke: #97B0F8;
113+
}
114+
76115
#application-timeline div.legend-area {
77116
margin-top: 5px;
78117
}
@@ -215,11 +254,20 @@ tr.corresponding-item-hover>td, tr.corresponding-item-hover>th {
215254
display: none;
216255
}
217256

257+
#task-assignment-timeline.collapsed {
258+
display: none;
259+
}
260+
218261
.control-panel {
219262
margin-bottom: 5px;
220263
}
221264

222-
span.expand-application-timeline, span.expand-job-timeline {
265+
#task-assignment-timeline .control-panel {
266+
float: left;
267+
}
268+
269+
span.expand-application-timeline, span.expand-job-timeline,
270+
span.expand-task-assignment-timeline {
223271
cursor: pointer;
224272
}
225273

core/src/main/resources/org/apache/spark/ui/static/timeline-view.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,41 @@ function drawTaskAssignmentTimeline(groupArray, eventObjArray, minLaunchTime, zo
168168
}
169169
taskTimeline.setWindow(minLaunchTime, curEnd);
170170
setupZoomable('#task-assignment-timeline-zoom-lock', taskTimeline);
171+
172+
function setupTaskEventAction() {
173+
$(".item.range.task.task-assignment-timeline-object").each(function() {
174+
var getTaskIdx = function(baseElem) {
175+
var taskIdxText = $($(baseElem).find(".task-assignment-timeline-content")[0]).text();
176+
var taskIdx = taskIdxText.match("Task (\\d+)\\(")[1];
177+
return taskIdx;
178+
};
179+
180+
$(this).hover(
181+
function() {
182+
var id = getTaskIdx(this);
183+
$($(this).find("div.task-assignment-timeline-content")[0]).tooltip("show");
184+
},
185+
function() {
186+
var id = getTaskIdx(this);
187+
$($(this).find("div.task-assignment-timeline-content")[0])
188+
.tooltip("hide");
189+
}
190+
);
191+
});
192+
}
193+
194+
setupTaskEventAction();
195+
taskTimeline.on("rangechanged", function(properties) {
196+
setupTaskEventAction();
197+
});
198+
199+
$("span.expand-task-assignment-timeline").click(function() {
200+
$("#task-assignment-timeline").toggleClass('collapsed');
201+
202+
// Switch the class of the arrow from open to closed.
203+
$(this).find('.expand-task-assignment-timeline-arrow').toggleClass('arrow-open');
204+
$(this).find('.expand-task-assignment-timeline-arrow').toggleClass('arrow-closed');
205+
});
171206
}
172207

173208
function setupExecutorEventAction() {

0 commit comments

Comments
 (0)