3 <div id="log_graph_div"
4 class="arv-log-event-listener"
5 data-object-uuid="<%= @object.uuid %>"></div>
7 <% log_history = stderr_log_history([@object.uuid]) %>
9 <div id="event_log_div"
10 class="arv-log-event-listener arv-log-event-handler-append-logs arv-job-log-window"
11 data-object-uuid="<%= @object.uuid %>"
12 ><%= log_history.join("\n") %></div>
14 <%# Applying a long throttle suppresses the auto-refresh of this
15 partial that would normally be triggered by arv-log-event. %>
16 <div class="arv-log-refresh-control"
17 data-load-throttle="86486400000" <%# 1001 nights %>
20 <%= javascript_tag do %>
21 window.jobGraphData = [];
22 window.jobGraphSeries = [];
23 window.jobGraphSortedSeries = [];
24 window.jobGraphMaxima = {};
25 $.get('<%= push_logs_job_path(@object) %>');
26 createJobGraph('log_graph_div');
34 var logViewer = new List('log-viewer', {
35 valueNames: [ 'id', 'timestamp', 'taskid', 'message', 'type'],
39 logViewer.page_offset = 0;
40 logViewer.on("updated", function() { updatePaging(".log-viewer-paging", logViewer, pagesize) } );
41 $(".log-viewer-page-up").on("click", function() { prevPage(logViewer, pagesize, ".log-viewer-paging"); return false; });
42 $(".log-viewer-page-down").on("click", function() { nextPage(logViewer, pagesize, ".log-viewer-paging"); return false; });
44 var taskState = newTaskState();
46 var makeFilter = function() {
48 $(".toggle-filter, .radio-filter").each(function(i, e) {
50 pass.push(e.id.substr(5));
54 return (function(item) {
56 if (item.values().taskid !== "") {
58 if (pass[a] == "all-tasks") { v = true; }
59 else if (pass[a] == "successful-tasks" && taskState[item.values().taskid].outcome == "success") { v = true; }
60 else if (pass[a] == "failed-tasks" && taskState[item.values().taskid].outcome == "failure") { v = true; }
66 if (pass[a] == item.values().type) { return v; }
73 <% logcollection = Collection.find @object.log %>
74 <% if logcollection %>
75 log_size = <%= logcollection.files[0][2] %>
76 log_maxbytes = <%= Rails.configuration.log_viewer_max_bytes %>;
77 logcollection_url = '<%=j url_for logcollection %>/<%=j logcollection.files[0][1] %>';
78 $("#log-viewer-download-url").attr('href', logcollection_url);
79 $("#log-viewer-download-pane").show();
80 if (log_size > log_maxbytes) {
81 range_header = { 'Range': 'bytes=0-' + log_maxbytes };
85 $.ajax(logcollection_url, { headers: range_header }).
86 done(function(data, status, jqxhr) {
88 addToLogViewer(logViewer, data.split("\n"), taskState);
89 logViewer.filter(makeFilter());
90 content_range_hdr = jqxhr.getResponseHeader('Content-Range');
91 var v = content_range_hdr && content_range_hdr.match(/bytes \d+-(\d+)\/(.+)/);
92 short_log = v && (v[2] == '*' || parseInt(v[1]) + 1 < v[2]);
93 if (jqxhr.status == 206 && short_log) {
94 $("#log-viewer-overview").html(
95 '<p>Showing only ' + data.length + ' bytes of this log.' +
96 ' Timing information is unavailable since' +
97 ' the full log was not retrieved.</p>'
100 generateJobOverview("#log-viewer-overview", logViewer, taskState);
102 $("#log-viewer .spinner").detach();
104 fail(function(jqxhr, status, error) {
105 $("#log-viewer .spinner").detach();
109 <%# Live log loading not implemented yet. %>
112 $(".toggle-filter, .radio-filter").on("change", function() {
113 logViewer.filter(makeFilter());
116 $("#filter-all").on("click", function() {
117 $(".toggle-filter").each(function(i, f) { f.checked = true; });
118 logViewer.filter(makeFilter());
121 $("#filter-none").on("click", function() {
122 $(".toggle-filter").each(function(i, f) { f.checked = false; console.log(f); });
123 logViewer.filter(makeFilter());
126 $("#sort-by-time").on("change", function() {
127 logViewer.sort("id", {sortFunction: sortById});
130 $("#sort-by-task").on("change", function() {
131 logViewer.sort("taskid", {sortFunction: sortByTask});
134 $("#sort-by-node").on("change", function() {
135 logViewer.sort("node", {sortFunction: sortByNode});
138 $("#set-show-failed-only").on("click", function() {
139 $("#sort-by-task").prop("checked", true);
140 $("#show-failed-tasks").prop("checked", true);
141 $("#show-crunch").prop("checked", false);
142 $("#show-task-dispatch").prop("checked", true);
143 $("#show-script-print").prop("checked", true);
144 $("#show-crunchstat").prop("checked", false);
145 logViewer.filter(makeFilter());
146 logViewer.sort("taskid", {sortFunction: sortByTask});
153 <div id="log-viewer">
156 <p id="log-viewer-overview">
157 <% if !logcollection %>
158 The collection containing the job log was not found.
162 <p id="log-viewer-download-pane" style="display:none">
163 <a id="log-viewer-download-url" href="">Download the full log</a>
168 <span class="pull-right">
169 <% if @object.andand.tasks_summary.andand[:failed] and @object.tasks_summary[:failed] > 0 %>
170 <button id="set-show-failed-only" class="btn btn-danger">
171 Show failed task diagnostics only
175 <button id="filter-all" class="btn">
178 <button id="filter-none" class="btn">
184 <input class="search pull-right" style="margin-top: 1em" placeholder="Search" />
187 <div class="radio-inline log-viewer-button" style="margin-left: 10px">
188 <label><input id="sort-by-time" type="radio" name="sort-radio" checked> Sort by time</label>
190 <div class="radio-inline log-viewer-button">
191 <label><input id="sort-by-node" type="radio" name="sort-radio" > Sort by node</label>
194 <div class="radio-inline log-viewer-button">
195 <label><input id="sort-by-task" type="radio" name="sort-radio" > Sort by task</label>
200 <div class="radio-inline log-viewer-button" style="margin-left: 10px">
201 <label><input id="show-all-tasks" type="radio" name="show-tasks-group" checked="true" class="radio-filter"> Show all tasks</label>
203 <div class="radio-inline log-viewer-button">
204 <label><input id="show-successful-tasks" type="radio" name="show-tasks-group" class="radio-filter"> Only successful tasks</label>
206 <div class="radio-inline log-viewer-button">
207 <label><input id="show-failed-tasks" type="radio" name="show-tasks-group" class="radio-filter"> Only failed tasks</label>
212 <div class="checkbox-inline log-viewer-button" style="margin-left: 10px">
213 <label><input id="show-crunch" type="checkbox" checked="true" class="toggle-filter"> Show crunch diagnostics</label>
215 <div class="checkbox-inline log-viewer-button">
216 <label><input id="show-task-dispatch" type="checkbox" checked="true" class="toggle-filter"> Show task dispatch</label>
218 <div class="checkbox-inline log-viewer-button">
219 <label><input id="show-task-print" type="checkbox" checked="true" class="toggle-filter"> Show task diagnostics</label>
221 <div class="checkbox-inline log-viewer-button">
222 <label><input id="show-crunchstat" type="checkbox" checked="true" class="toggle-filter"> Show compute usage</label>
227 <div class="smart-scroll" data-smart-scroll-padding-bottom="50" style="margin-bottom: 0px">
228 <table class="log-viewer-table">
231 <th class="id" data-sort="id"></th>
232 <th class="timestamp" data-sort="timestamp">Timestamp</th>
233 <th class="node" data-sort="node">Node</th>
234 <th class="slot" data-sort="slot">Slot</th>
235 <th class="type" data-sort="type">Log type</th>
236 <th class="taskid" data-sort="taskid">Task</th>
237 <th class="message" data-sort="message">Message</th>
243 <td class="timestamp"></td>
244 <td class="node"></td>
245 <td class="slot"></td>
246 <td class="type"></td>
247 <td class="taskid"></td>
248 <td class="message"></td>
253 <% if @object.log and logcollection %>
254 <div class="spinner spinner-32px"></div>
259 <div class="log-viewer-paging-div" style="margin-bottom: -15px">
260 <a href="#" class="log-viewer-page-up"><span class='glyphicon glyphicon-arrow-up'></span></a>
261 <span class="log-viewer-paging"></span>
262 <a href="#" class="log-viewer-page-down"><span class='glyphicon glyphicon-arrow-down'></span></a>