Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebUI timelines #50

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .rat-excludes
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
target
cache
.gitignore
.gitattributes
.project
Expand All @@ -18,6 +19,7 @@ fairscheduler.xml.template
spark-defaults.conf.template
log4j.properties
log4j.properties.template
metrics.properties
metrics.properties.template
slaves
slaves.template
Expand All @@ -28,6 +30,9 @@ log4j-defaults.properties
bootstrap-tooltip.js
jquery-1.11.1.min.js
sorttable.js
vis.min.js
vis.min.css
vis.map
.*avsc
.*txt
.*json
Expand Down Expand Up @@ -65,3 +70,5 @@ logs
.*scalastyle-output.xml
.*dependency-reduced-pom.xml
known_translations
DESCRIPTION
NAMESPACE
155 changes: 155 additions & 0 deletions core/src/main/resources/org/apache/spark/ui/static/timeline-view.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

div#application-timeline, div#job-timeline {
margin-bottom: 30px;
}

#application-timeline div.legend-area {
margin-top: 20px;
}

#task-assignment-timeline div.legend-area {
float: right;
border: 1px solid #000000;
}

#task-assignment-timeline .legend-area>svg {
width: 600px;
height: 80px;
}

#task-assignment-timeline>div.control-panel {
float: left;
}

.control-panel input+span {
cursor: pointer;
}

#task-assignment-timeline>.timeline-header:after {
content: "";
clear: both;
height: 0;
display: block;
visibility: hidden;
}

#task-assignment-timeline div.item.range {
padding: 0px;
height: 40px;
}

.task-assignment-timeline-content {
width: 100%;
height: 19px;
}

.task-assignment-timeline-duration-bar {
width: 100%;
height: 19px;
}

.vis.timeline div.content {
width: 100%;
}

.vis.timeline .item.task.succeeded {
background-color: #D5DDF6;
}

.vis.timeline .item.task.failed {
background-color: #FF5475;
}

.vis.timeline .item.task.running {
background-color: #FDFFCA;
}

.vis.timeline .item.stage.succeeded {
background-color: #D5DDF6;
}

.vis.timeline .item.stage.succeeded.selected {
background-color: #D5DDF6;
border-color: #97B0F8;
z-index: auto;
}

.vis.timeline .item.stage.failed {
background-color: #FF5475;
}

.vis.timeline .item.stage.failed.selected {
background-color: #FF5475;
border-color: #97B0F8;
z-index: auto;
}

.vis.timeline .item.stage.running {
background-color: #FDFFCA;
}

.vis.timeline .item.stage.running.selected {
background-color: #FDFFCA;
border-color: #97B0F8;
z-index: auto;
}

.vis.timeline .item.job.succeeded {
background-color: #D5DDF6;
}

.vis.timeline .item.job.succeeded.selected {
background-color: #D5DDF6;
border-color: #97B0F8;
z-index: auto;
}

.vis.timeline .item.job.failed {
background-color: #FF5475;
}

.vis.timeline .item.job.failed.selected {
background-color: #FF5475;
border-color: #97B0F8;
z-index: auto;
}

.vis.timeline .item.job.running {
background-color: #FDFFCA;
}

.vis.timeline .item.job.running.selected {
background-color: #FDFFCA;
border-color: #97B0F8;
z-index: auto;
}

.vis.timeline .item.executor.added {
background-color: #D5DDF6;
}

.vis.timeline .item.executor.removed {
background-color: #EBCA59;
}

.vis.timeline .item.executor.selected {
border-color: #FFC200;
background-color: #FFF785;
z-index: 2;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

function drawApplicationTimeline(groupArray, eventObjArray) {
var groups = new vis.DataSet(groupArray);
var items = new vis.DataSet(eventObjArray);
var container = $("#application-timeline")[0];
var options = {
groupOrder: function(a, b) {
return a.value - b.value
},
editable: false,
showCurrentTime: false,
zoomable: false
};

var applicationTimeline = new vis.Timeline(container);
applicationTimeline.setOptions(options);
applicationTimeline.setGroups(groups);
applicationTimeline.setItems(items);

setupZoomable("#application-timeline-zoom-lock", applicationTimeline);
}

function drawJobTimeline(groupArray, eventObjArray) {
var groups = new vis.DataSet(groupArray);
var items = new vis.DataSet(eventObjArray);
var container = $('#job-timeline')[0];
var options = {
groupOrder: function(a, b) {
return a.value - b.value;
},
editable: false,
showCurrentTime: false,
zoomable: false,
};

var jobTimeline = new vis.Timeline(container);
jobTimeline.setOptions(options);
jobTimeline.setGroups(groups);
jobTimeline.setItems(items);

setupZoomable("#job-timeline-zoom-lock", jobTimeline);
}

function drawTaskAssignmentTimeline(groupArray, eventObjArray) {
var groups = new vis.DataSet(groupArray);
var items = new vis.DataSet(eventObjArray);
var container = $("#task-assignment-timeline")[0]
var options = {
groupOrder: function(a, b) {
return a.value - b.value
},
editable: false,
align: 'left',
selectable: false,
showCurrentTime: false,
zoomable: false
};

var taskTimeline = new vis.Timeline(container)
taskTimeline.setOptions(options);
taskTimeline.setGroups(groups);
taskTimeline.setItems(items);

setupZoomable('#task-assignment-timeline-zoom-lock', taskTimeline);
}

function setupZoomable(id, timeline) {
$(id + '>input[type="checkbox"]').click(function() {
if (this.checked) {
timeline.setOptions({zoomable: false});
} else {
timeline.setOptions({zoomable: true});
}
});

$(id + ">span").click(function() {
$(this).parent().find('input:checkbox').trigger('click');
});
}
1 change: 1 addition & 0 deletions core/src/main/resources/org/apache/spark/ui/static/vis.map

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 39 additions & 0 deletions core/src/main/resources/org/apache/spark/ui/static/vis.min.js

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions core/src/main/scala/org/apache/spark/ui/UIUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -149,20 +149,27 @@ private[spark] object UIUtils extends Logging {
}
}

def prependBaseUri(basePath: String = "", resource: String = "") = uiRoot + basePath + resource
def prependBaseUri(basePath: String = "", resource: String = ""): String = {
uiRoot + basePath + resource
}

def commonHeaderNodes = {
def commonHeaderNodes: Seq[Node] = {
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href={prependBaseUri("/static/bootstrap.min.css")}
type="text/css" />
<link rel="stylesheet" href={prependBaseUri("/static/webui.css")}
type="text/css" />
<link rel="stylesheet" href={prependBaseUri("/static/vis.min.css")}
typ="text/css" />
<link rel="stylesheet" href={prependBaseUri("/static/timeline-view.css")}></link>
<script src={prependBaseUri("/static/sorttable.js")} ></script>
<script src={prependBaseUri("/static/jquery-1.11.1.min.js")}></script>
<script src={prependBaseUri("/static/vis.min.js")}></script>
<script src={prependBaseUri("/static/bootstrap-tooltip.js")}></script>
<script src={prependBaseUri("/static/initialize-tooltips.js")}></script>
<script src={prependBaseUri("/static/table.js")}></script>
<script src={prependBaseUri("/static/additional-metrics.js")}></script>
<script src={prependBaseUri("/static/timeline-view.js")}></script>
}

/** Returns a spark page with correctly formatted headers */
Expand Down
Loading