3 <div id="log_graph_div" data-object-uuid="<%= @object.uuid %>"></div>
5 <% log_history = stderr_log_history([@object.uuid]) %>
7 <div id="event_log_div"
8 class="arv-log-event-listener arv-log-event-handler-append-logs arv-job-log-window"
9 data-object-uuid="<%= @object.uuid %>"
10 ><%= log_history.join("\n") %></div>
12 <%# Applying a long throttle suppresses the auto-refresh of this
13 partial that would normally be triggered by arv-log-event. %>
14 <div class="arv-log-refresh-control"
15 data-load-throttle="86486400000" <%# 1001 nights %>
18 <%= javascript_tag do %>
19 var jobGraphData = [];
20 var jobGraphSeries = [];
21 <% stderr_log_records([@object.uuid]).each.with_index do |log_record, index| %>
22 <% puts log_record.to_yaml %>
23 var logLine = '<%=j log_record.properties[:text] %>';
24 processLogLineForChart( logLine, jobGraphSeries, jobGraphData );
26 var jobGraph = Morris.Line({
27 element: 'log_graph_div',
30 ykeys: jobGraphSeries,
31 labels: jobGraphSeries
40 var logViewer = new List('log-viewer', {
41 valueNames: [ 'id', 'timestamp', 'taskid', 'message', 'type'],
45 logViewer.page_offset = 0;
46 logViewer.on("updated", function() { updatePaging(".log-viewer-paging", logViewer, pagesize) } );
47 $(".log-viewer-page-up").on("click", function() { prevPage(logViewer, pagesize, ".log-viewer-paging"); return false; });
48 $(".log-viewer-page-down").on("click", function() { nextPage(logViewer, pagesize, ".log-viewer-paging"); return false; });
50 var taskState = newTaskState();
52 var makeFilter = function() {
54 $(".toggle-filter, .radio-filter").each(function(i, e) {
56 pass.push(e.id.substr(5));
60 return (function(item) {
62 if (item.values().taskid !== "") {
64 if (pass[a] == "all-tasks") { v = true; }
65 else if (pass[a] == "successful-tasks" && taskState[item.values().taskid].outcome == "success") { v = true; }
66 else if (pass[a] == "failed-tasks" && taskState[item.values().taskid].outcome == "failure") { v = true; }
72 if (pass[a] == item.values().type) { return v; }
79 <% logcollection = Collection.find @object.log %>
80 <% if logcollection %>
81 log_size = <%= logcollection.files[0][2] %>
82 log_maxbytes = <%= Rails.configuration.log_viewer_max_bytes %>;
83 logcollection_url = '<%=j url_for logcollection %>/<%=j logcollection.files[0][1] %>';
84 $("#log-viewer-download-url").attr('href', logcollection_url);
85 $("#log-viewer-download-pane").show();
86 if (log_size > log_maxbytes) {
87 range_header = { 'Range': 'bytes=0-' + log_maxbytes };
91 $.ajax(logcollection_url, { headers: range_header }).
92 done(function(data, status, jqxhr) {
94 addToLogViewer(logViewer, data.split("\n"), taskState);
95 logViewer.filter(makeFilter());
96 content_range_hdr = jqxhr.getResponseHeader('Content-Range');
97 var v = content_range_hdr && content_range_hdr.match(/bytes \d+-(\d+)\/(.+)/);
98 short_log = v && (v[2] == '*' || parseInt(v[1]) + 1 < v[2]);
99 if (jqxhr.status == 206 && short_log) {
100 $("#log-viewer-overview").html(
101 '<p>Showing only ' + data.length + ' bytes of this log.' +
102 ' Timing information is unavailable since' +
103 ' the full log was not retrieved.</p>'
106 generateJobOverview("#log-viewer-overview", logViewer, taskState);
108 $("#log-viewer .spinner").detach();
110 fail(function(jqxhr, status, error) {
111 $("#log-viewer .spinner").detach();
115 <%# Live log loading not implemented yet. %>
118 $(".toggle-filter, .radio-filter").on("change", function() {
119 logViewer.filter(makeFilter());
122 $("#filter-all").on("click", function() {
123 $(".toggle-filter").each(function(i, f) { f.checked = true; });
124 logViewer.filter(makeFilter());
127 $("#filter-none").on("click", function() {
128 $(".toggle-filter").each(function(i, f) { f.checked = false; console.log(f); });
129 logViewer.filter(makeFilter());
132 $("#sort-by-time").on("change", function() {
133 logViewer.sort("id", {sortFunction: sortById});
136 $("#sort-by-task").on("change", function() {
137 logViewer.sort("taskid", {sortFunction: sortByTask});
140 $("#sort-by-node").on("change", function() {
141 logViewer.sort("node", {sortFunction: sortByNode});
144 $("#set-show-failed-only").on("click", function() {
145 $("#sort-by-task").prop("checked", true);
146 $("#show-failed-tasks").prop("checked", true);
147 $("#show-crunch").prop("checked", false);
148 $("#show-task-dispatch").prop("checked", true);
149 $("#show-script-print").prop("checked", true);
150 $("#show-crunchstat").prop("checked", false);
151 logViewer.filter(makeFilter());
152 logViewer.sort("taskid", {sortFunction: sortByTask});
159 <div id="log-viewer">
162 <p id="log-viewer-overview">
163 <% if !logcollection %>
164 The collection containing the job log was not found.
168 <p id="log-viewer-download-pane" style="display:none">
169 <a id="log-viewer-download-url" href="">Download the full log</a>
174 <span class="pull-right">
175 <% if @object.andand.tasks_summary.andand[:failed] and @object.tasks_summary[:failed] > 0 %>
176 <button id="set-show-failed-only" class="btn btn-danger">
177 Show failed task diagnostics only
181 <button id="filter-all" class="btn">
184 <button id="filter-none" class="btn">
190 <input class="search pull-right" style="margin-top: 1em" placeholder="Search" />
193 <div class="radio-inline log-viewer-button" style="margin-left: 10px">
194 <label><input id="sort-by-time" type="radio" name="sort-radio" checked> Sort by time</label>
196 <div class="radio-inline log-viewer-button">
197 <label><input id="sort-by-node" type="radio" name="sort-radio" > Sort by node</label>
200 <div class="radio-inline log-viewer-button">
201 <label><input id="sort-by-task" type="radio" name="sort-radio" > Sort by task</label>
206 <div class="radio-inline log-viewer-button" style="margin-left: 10px">
207 <label><input id="show-all-tasks" type="radio" name="show-tasks-group" checked="true" class="radio-filter"> Show all tasks</label>
209 <div class="radio-inline log-viewer-button">
210 <label><input id="show-successful-tasks" type="radio" name="show-tasks-group" class="radio-filter"> Only successful tasks</label>
212 <div class="radio-inline log-viewer-button">
213 <label><input id="show-failed-tasks" type="radio" name="show-tasks-group" class="radio-filter"> Only failed tasks</label>
218 <div class="checkbox-inline log-viewer-button" style="margin-left: 10px">
219 <label><input id="show-crunch" type="checkbox" checked="true" class="toggle-filter"> Show crunch diagnostics</label>
221 <div class="checkbox-inline log-viewer-button">
222 <label><input id="show-task-dispatch" type="checkbox" checked="true" class="toggle-filter"> Show task dispatch</label>
224 <div class="checkbox-inline log-viewer-button">
225 <label><input id="show-task-print" type="checkbox" checked="true" class="toggle-filter"> Show task diagnostics</label>
227 <div class="checkbox-inline log-viewer-button">
228 <label><input id="show-crunchstat" type="checkbox" checked="true" class="toggle-filter"> Show compute usage</label>
233 <div class="smart-scroll" data-smart-scroll-padding-bottom="50" style="margin-bottom: 0px">
234 <table class="log-viewer-table">
237 <th class="id" data-sort="id"></th>
238 <th class="timestamp" data-sort="timestamp">Timestamp</th>
239 <th class="node" data-sort="node">Node</th>
240 <th class="slot" data-sort="slot">Slot</th>
241 <th class="type" data-sort="type">Log type</th>
242 <th class="taskid" data-sort="taskid">Task</th>
243 <th class="message" data-sort="message">Message</th>
249 <td class="timestamp"></td>
250 <td class="node"></td>
251 <td class="slot"></td>
252 <td class="type"></td>
253 <td class="taskid"></td>
254 <td class="message"></td>
259 <% if @object.log and logcollection %>
260 <div class="spinner spinner-32px"></div>
265 <div class="log-viewer-paging-div" style="margin-bottom: -15px">
266 <a href="#" class="log-viewer-page-up"><span class='glyphicon glyphicon-arrow-up'></span></a>
267 <span class="log-viewer-paging"></span>
268 <a href="#" class="log-viewer-page-down"><span class='glyphicon glyphicon-arrow-down'></span></a>