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.jobGraphMaxima = {};
24 <% stderr_log_records([@object.uuid],[['properties','~','crunchstat:.*-- interval']])
25 .each do |log_record| %>
26 processLogLineForChart( '<%=j log_record.properties[:text] %>' );
28 createJobGraph('log_graph_div');
36 var logViewer = new List('log-viewer', {
37 valueNames: [ 'id', 'timestamp', 'taskid', 'message', 'type'],
41 logViewer.page_offset = 0;
42 logViewer.on("updated", function() { updatePaging(".log-viewer-paging", logViewer, pagesize) } );
43 $(".log-viewer-page-up").on("click", function() { prevPage(logViewer, pagesize, ".log-viewer-paging"); return false; });
44 $(".log-viewer-page-down").on("click", function() { nextPage(logViewer, pagesize, ".log-viewer-paging"); return false; });
46 var taskState = newTaskState();
48 var makeFilter = function() {
50 $(".toggle-filter, .radio-filter").each(function(i, e) {
52 pass.push(e.id.substr(5));
56 return (function(item) {
58 if (item.values().taskid !== "") {
60 if (pass[a] == "all-tasks") { v = true; }
61 else if (pass[a] == "successful-tasks" && taskState[item.values().taskid].outcome == "success") { v = true; }
62 else if (pass[a] == "failed-tasks" && taskState[item.values().taskid].outcome == "failure") { v = true; }
68 if (pass[a] == item.values().type) { return v; }
75 <% logcollection = Collection.find @object.log %>
76 <% if logcollection %>
77 log_size = <%= logcollection.files[0][2] %>
78 log_maxbytes = <%= Rails.configuration.log_viewer_max_bytes %>;
79 logcollection_url = '<%=j url_for logcollection %>/<%=j logcollection.files[0][1] %>';
80 $("#log-viewer-download-url").attr('href', logcollection_url);
81 $("#log-viewer-download-pane").show();
82 if (log_size > log_maxbytes) {
83 range_header = { 'Range': 'bytes=0-' + log_maxbytes };
87 $.ajax(logcollection_url, { headers: range_header }).
88 done(function(data, status, jqxhr) {
90 addToLogViewer(logViewer, data.split("\n"), taskState);
91 logViewer.filter(makeFilter());
92 content_range_hdr = jqxhr.getResponseHeader('Content-Range');
93 var v = content_range_hdr && content_range_hdr.match(/bytes \d+-(\d+)\/(.+)/);
94 short_log = v && (v[2] == '*' || parseInt(v[1]) + 1 < v[2]);
95 if (jqxhr.status == 206 && short_log) {
96 $("#log-viewer-overview").html(
97 '<p>Showing only ' + data.length + ' bytes of this log.' +
98 ' Timing information is unavailable since' +
99 ' the full log was not retrieved.</p>'
102 generateJobOverview("#log-viewer-overview", logViewer, taskState);
104 $("#log-viewer .spinner").detach();
106 fail(function(jqxhr, status, error) {
107 $("#log-viewer .spinner").detach();
111 <%# Live log loading not implemented yet. %>
114 $(".toggle-filter, .radio-filter").on("change", function() {
115 logViewer.filter(makeFilter());
118 $("#filter-all").on("click", function() {
119 $(".toggle-filter").each(function(i, f) { f.checked = true; });
120 logViewer.filter(makeFilter());
123 $("#filter-none").on("click", function() {
124 $(".toggle-filter").each(function(i, f) { f.checked = false; console.log(f); });
125 logViewer.filter(makeFilter());
128 $("#sort-by-time").on("change", function() {
129 logViewer.sort("id", {sortFunction: sortById});
132 $("#sort-by-task").on("change", function() {
133 logViewer.sort("taskid", {sortFunction: sortByTask});
136 $("#sort-by-node").on("change", function() {
137 logViewer.sort("node", {sortFunction: sortByNode});
140 $("#set-show-failed-only").on("click", function() {
141 $("#sort-by-task").prop("checked", true);
142 $("#show-failed-tasks").prop("checked", true);
143 $("#show-crunch").prop("checked", false);
144 $("#show-task-dispatch").prop("checked", true);
145 $("#show-script-print").prop("checked", true);
146 $("#show-crunchstat").prop("checked", false);
147 logViewer.filter(makeFilter());
148 logViewer.sort("taskid", {sortFunction: sortByTask});
155 <div id="log-viewer">
158 <p id="log-viewer-overview">
159 <% if !logcollection %>
160 The collection containing the job log was not found.
164 <p id="log-viewer-download-pane" style="display:none">
165 <a id="log-viewer-download-url" href="">Download the full log</a>
170 <span class="pull-right">
171 <% if @object.andand.tasks_summary.andand[:failed] and @object.tasks_summary[:failed] > 0 %>
172 <button id="set-show-failed-only" class="btn btn-danger">
173 Show failed task diagnostics only
177 <button id="filter-all" class="btn">
180 <button id="filter-none" class="btn">
186 <input class="search pull-right" style="margin-top: 1em" placeholder="Search" />
189 <div class="radio-inline log-viewer-button" style="margin-left: 10px">
190 <label><input id="sort-by-time" type="radio" name="sort-radio" checked> Sort by time</label>
192 <div class="radio-inline log-viewer-button">
193 <label><input id="sort-by-node" type="radio" name="sort-radio" > Sort by node</label>
196 <div class="radio-inline log-viewer-button">
197 <label><input id="sort-by-task" type="radio" name="sort-radio" > Sort by task</label>
202 <div class="radio-inline log-viewer-button" style="margin-left: 10px">
203 <label><input id="show-all-tasks" type="radio" name="show-tasks-group" checked="true" class="radio-filter"> Show all tasks</label>
205 <div class="radio-inline log-viewer-button">
206 <label><input id="show-successful-tasks" type="radio" name="show-tasks-group" class="radio-filter"> Only successful tasks</label>
208 <div class="radio-inline log-viewer-button">
209 <label><input id="show-failed-tasks" type="radio" name="show-tasks-group" class="radio-filter"> Only failed tasks</label>
214 <div class="checkbox-inline log-viewer-button" style="margin-left: 10px">
215 <label><input id="show-crunch" type="checkbox" checked="true" class="toggle-filter"> Show crunch diagnostics</label>
217 <div class="checkbox-inline log-viewer-button">
218 <label><input id="show-task-dispatch" type="checkbox" checked="true" class="toggle-filter"> Show task dispatch</label>
220 <div class="checkbox-inline log-viewer-button">
221 <label><input id="show-task-print" type="checkbox" checked="true" class="toggle-filter"> Show task diagnostics</label>
223 <div class="checkbox-inline log-viewer-button">
224 <label><input id="show-crunchstat" type="checkbox" checked="true" class="toggle-filter"> Show compute usage</label>
229 <div class="smart-scroll" data-smart-scroll-padding-bottom="50" style="margin-bottom: 0px">
230 <table class="log-viewer-table">
233 <th class="id" data-sort="id"></th>
234 <th class="timestamp" data-sort="timestamp">Timestamp</th>
235 <th class="node" data-sort="node">Node</th>
236 <th class="slot" data-sort="slot">Slot</th>
237 <th class="type" data-sort="type">Log type</th>
238 <th class="taskid" data-sort="taskid">Task</th>
239 <th class="message" data-sort="message">Message</th>
245 <td class="timestamp"></td>
246 <td class="node"></td>
247 <td class="slot"></td>
248 <td class="type"></td>
249 <td class="taskid"></td>
250 <td class="message"></td>
255 <% if @object.log and logcollection %>
256 <div class="spinner spinner-32px"></div>
261 <div class="log-viewer-paging-div" style="margin-bottom: -15px">
262 <a href="#" class="log-viewer-page-up"><span class='glyphicon glyphicon-arrow-up'></span></a>
263 <span class="log-viewer-paging"></span>
264 <a href="#" class="log-viewer-page-down"><span class='glyphicon glyphicon-arrow-down'></span></a>