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 <% stderr_log_records([@object.uuid],[['properties','~','crunchstat:.*-- interval']])
26 .each do |log_record| %>
27 processLogLineForChart( '<%=j log_record.properties[:text] %>' );
29 createJobGraph('log_graph_div');
37 var logViewer = new List('log-viewer', {
38 valueNames: [ 'id', 'timestamp', 'taskid', 'message', 'type'],
42 logViewer.page_offset = 0;
43 logViewer.on("updated", function() { updatePaging(".log-viewer-paging", logViewer, pagesize) } );
44 $(".log-viewer-page-up").on("click", function() { prevPage(logViewer, pagesize, ".log-viewer-paging"); return false; });
45 $(".log-viewer-page-down").on("click", function() { nextPage(logViewer, pagesize, ".log-viewer-paging"); return false; });
47 var taskState = newTaskState();
49 var makeFilter = function() {
51 $(".toggle-filter, .radio-filter").each(function(i, e) {
53 pass.push(e.id.substr(5));
57 return (function(item) {
59 if (item.values().taskid !== "") {
61 if (pass[a] == "all-tasks") { v = true; }
62 else if (pass[a] == "successful-tasks" && taskState[item.values().taskid].outcome == "success") { v = true; }
63 else if (pass[a] == "failed-tasks" && taskState[item.values().taskid].outcome == "failure") { v = true; }
69 if (pass[a] == item.values().type) { return v; }
76 <% logcollection = Collection.find @object.log %>
77 <% if logcollection %>
78 log_size = <%= logcollection.files[0][2] %>
79 log_maxbytes = <%= Rails.configuration.log_viewer_max_bytes %>;
80 logcollection_url = '<%=j url_for logcollection %>/<%=j logcollection.files[0][1] %>';
81 $("#log-viewer-download-url").attr('href', logcollection_url);
82 $("#log-viewer-download-pane").show();
83 if (log_size > log_maxbytes) {
84 range_header = { 'Range': 'bytes=0-' + log_maxbytes };
88 $.ajax(logcollection_url, { headers: range_header }).
89 done(function(data, status, jqxhr) {
91 addToLogViewer(logViewer, data.split("\n"), taskState);
92 logViewer.filter(makeFilter());
93 content_range_hdr = jqxhr.getResponseHeader('Content-Range');
94 var v = content_range_hdr && content_range_hdr.match(/bytes \d+-(\d+)\/(.+)/);
95 short_log = v && (v[2] == '*' || parseInt(v[1]) + 1 < v[2]);
96 if (jqxhr.status == 206 && short_log) {
97 $("#log-viewer-overview").html(
98 '<p>Showing only ' + data.length + ' bytes of this log.' +
99 ' Timing information is unavailable since' +
100 ' the full log was not retrieved.</p>'
103 generateJobOverview("#log-viewer-overview", logViewer, taskState);
105 $("#log-viewer .spinner").detach();
107 fail(function(jqxhr, status, error) {
108 $("#log-viewer .spinner").detach();
112 <%# Live log loading not implemented yet. %>
115 $(".toggle-filter, .radio-filter").on("change", function() {
116 logViewer.filter(makeFilter());
119 $("#filter-all").on("click", function() {
120 $(".toggle-filter").each(function(i, f) { f.checked = true; });
121 logViewer.filter(makeFilter());
124 $("#filter-none").on("click", function() {
125 $(".toggle-filter").each(function(i, f) { f.checked = false; console.log(f); });
126 logViewer.filter(makeFilter());
129 $("#sort-by-time").on("change", function() {
130 logViewer.sort("id", {sortFunction: sortById});
133 $("#sort-by-task").on("change", function() {
134 logViewer.sort("taskid", {sortFunction: sortByTask});
137 $("#sort-by-node").on("change", function() {
138 logViewer.sort("node", {sortFunction: sortByNode});
141 $("#set-show-failed-only").on("click", function() {
142 $("#sort-by-task").prop("checked", true);
143 $("#show-failed-tasks").prop("checked", true);
144 $("#show-crunch").prop("checked", false);
145 $("#show-task-dispatch").prop("checked", true);
146 $("#show-script-print").prop("checked", true);
147 $("#show-crunchstat").prop("checked", false);
148 logViewer.filter(makeFilter());
149 logViewer.sort("taskid", {sortFunction: sortByTask});
156 <div id="log-viewer">
159 <p id="log-viewer-overview">
160 <% if !logcollection %>
161 The collection containing the job log was not found.
165 <p id="log-viewer-download-pane" style="display:none">
166 <a id="log-viewer-download-url" href="">Download the full log</a>
171 <span class="pull-right">
172 <% if @object.andand.tasks_summary.andand[:failed] and @object.tasks_summary[:failed] > 0 %>
173 <button id="set-show-failed-only" class="btn btn-danger">
174 Show failed task diagnostics only
178 <button id="filter-all" class="btn">
181 <button id="filter-none" class="btn">
187 <input class="search pull-right" style="margin-top: 1em" placeholder="Search" />
190 <div class="radio-inline log-viewer-button" style="margin-left: 10px">
191 <label><input id="sort-by-time" type="radio" name="sort-radio" checked> Sort by time</label>
193 <div class="radio-inline log-viewer-button">
194 <label><input id="sort-by-node" type="radio" name="sort-radio" > Sort by node</label>
197 <div class="radio-inline log-viewer-button">
198 <label><input id="sort-by-task" type="radio" name="sort-radio" > Sort by task</label>
203 <div class="radio-inline log-viewer-button" style="margin-left: 10px">
204 <label><input id="show-all-tasks" type="radio" name="show-tasks-group" checked="true" class="radio-filter"> Show all tasks</label>
206 <div class="radio-inline log-viewer-button">
207 <label><input id="show-successful-tasks" type="radio" name="show-tasks-group" class="radio-filter"> Only successful tasks</label>
209 <div class="radio-inline log-viewer-button">
210 <label><input id="show-failed-tasks" type="radio" name="show-tasks-group" class="radio-filter"> Only failed tasks</label>
215 <div class="checkbox-inline log-viewer-button" style="margin-left: 10px">
216 <label><input id="show-crunch" type="checkbox" checked="true" class="toggle-filter"> Show crunch diagnostics</label>
218 <div class="checkbox-inline log-viewer-button">
219 <label><input id="show-task-dispatch" type="checkbox" checked="true" class="toggle-filter"> Show task dispatch</label>
221 <div class="checkbox-inline log-viewer-button">
222 <label><input id="show-task-print" type="checkbox" checked="true" class="toggle-filter"> Show task diagnostics</label>
224 <div class="checkbox-inline log-viewer-button">
225 <label><input id="show-crunchstat" type="checkbox" checked="true" class="toggle-filter"> Show compute usage</label>
230 <div class="smart-scroll" data-smart-scroll-padding-bottom="50" style="margin-bottom: 0px">
231 <table class="log-viewer-table">
234 <th class="id" data-sort="id"></th>
235 <th class="timestamp" data-sort="timestamp">Timestamp</th>
236 <th class="node" data-sort="node">Node</th>
237 <th class="slot" data-sort="slot">Slot</th>
238 <th class="type" data-sort="type">Log type</th>
239 <th class="taskid" data-sort="taskid">Task</th>
240 <th class="message" data-sort="message">Message</th>
246 <td class="timestamp"></td>
247 <td class="node"></td>
248 <td class="slot"></td>
249 <td class="type"></td>
250 <td class="taskid"></td>
251 <td class="message"></td>
256 <% if @object.log and logcollection %>
257 <div class="spinner spinner-32px"></div>
262 <div class="log-viewer-paging-div" style="margin-bottom: -15px">
263 <a href="#" class="log-viewer-page-up"><span class='glyphicon glyphicon-arrow-up'></span></a>
264 <span class="log-viewer-paging"></span>
265 <a href="#" class="log-viewer-page-down"><span class='glyphicon glyphicon-arrow-down'></span></a>