3 <div id="log_graph_div"
4 class="arv-log-event-listener"
6 data-object-uuid="<%= @object.uuid %>"></div>
8 <div id="event_log_div"
9 class="arv-log-event-listener arv-log-event-handler-append-logs arv-job-log-window"
10 data-object-uuid="<%= @object.uuid %>"
13 <%# Applying a long throttle suppresses the auto-refresh of this
14 partial that would normally be triggered by arv-log-event. %>
15 <div class="arv-log-refresh-control"
16 data-load-throttle="86486400000" <%# 1001 nights %>
24 var logViewer = new List('log-viewer', {
25 valueNames: [ 'id', 'timestamp', 'taskid', 'message', 'type'],
29 logViewer.page_offset = 0;
30 logViewer.on("updated", function() { updatePaging(".log-viewer-paging", logViewer, pagesize) } );
31 $(".log-viewer-page-up").on("click", function() { prevPage(logViewer, pagesize, ".log-viewer-paging"); return false; });
32 $(".log-viewer-page-down").on("click", function() { nextPage(logViewer, pagesize, ".log-viewer-paging"); return false; });
34 var taskState = newTaskState();
36 var makeFilter = function() {
38 $(".toggle-filter, .radio-filter").each(function(i, e) {
40 pass.push(e.id.substr(5));
44 return (function(item) {
46 if (item.values().taskid !== "") {
48 if (pass[a] == "all-tasks") { v = true; }
49 else if (pass[a] == "successful-tasks" && taskState[item.values().taskid].outcome == "success") { v = true; }
50 else if (pass[a] == "failed-tasks" && taskState[item.values().taskid].outcome == "failure") { v = true; }
56 if (pass[a] == item.values().type) { return v; }
62 <% if @object.log and !@object.log.empty? %>
63 <% logcollection = Collection.find @object.log %>
64 <% if logcollection %>
65 log_size = <%= logcollection.files[0][2] %>
66 log_maxbytes = <%= Rails.configuration.log_viewer_max_bytes %>;
67 logcollection_url = '<%=j url_for logcollection %>/<%=j logcollection.files[0][1] %>';
68 $("#log-viewer-download-url").attr('href', logcollection_url);
69 $("#log-viewer-download-pane").show();
70 if (log_size > log_maxbytes) {
71 range_header = { 'Range': 'bytes=0-' + log_maxbytes };
75 $.ajax(logcollection_url, { headers: range_header }).
76 done(function(data, status, jqxhr) {
78 addToLogViewer(logViewer, data.split("\n"), taskState);
79 logViewer.filter(makeFilter());
80 content_range_hdr = jqxhr.getResponseHeader('Content-Range');
81 var v = content_range_hdr && content_range_hdr.match(/bytes \d+-(\d+)\/(.+)/);
82 short_log = v && (v[2] == '*' || parseInt(v[1]) + 1 < v[2]);
83 if (jqxhr.status == 206 && short_log) {
84 $("#log-viewer-overview").html(
85 '<p>Showing only ' + data.length + ' bytes of this log.' +
86 ' Timing information is unavailable since' +
87 ' the full log was not retrieved.</p>'
90 generateJobOverview("#log-viewer-overview", logViewer, taskState);
92 $("#log-viewer .spinner").detach();
94 fail(function(jqxhr, status, error) {
95 $("#log-viewer .spinner").detach();
99 <%# Live log loading not implemented yet. %>
102 $(".toggle-filter, .radio-filter").on("change", function() {
103 logViewer.filter(makeFilter());
106 $("#filter-all").on("click", function() {
107 $(".toggle-filter").each(function(i, f) { f.checked = true; });
108 logViewer.filter(makeFilter());
111 $("#filter-none").on("click", function() {
112 $(".toggle-filter").each(function(i, f) { f.checked = false; console.log(f); });
113 logViewer.filter(makeFilter());
116 $("#sort-by-time").on("change", function() {
117 logViewer.sort("id", {sortFunction: sortById});
120 $("#sort-by-task").on("change", function() {
121 logViewer.sort("taskid", {sortFunction: sortByTask});
124 $("#sort-by-node").on("change", function() {
125 logViewer.sort("node", {sortFunction: sortByNode});
128 $("#set-show-failed-only").on("click", function() {
129 $("#sort-by-task").prop("checked", true);
130 $("#show-failed-tasks").prop("checked", true);
131 $("#show-crunch").prop("checked", false);
132 $("#show-task-dispatch").prop("checked", true);
133 $("#show-script-print").prop("checked", true);
134 $("#show-crunchstat").prop("checked", false);
135 logViewer.filter(makeFilter());
136 logViewer.sort("taskid", {sortFunction: sortByTask});
143 <div id="log-viewer">
146 <p id="log-viewer-overview">
147 <% if !logcollection %>
148 The collection containing the job log was not found.
152 <p id="log-viewer-download-pane" style="display:none">
153 <a id="log-viewer-download-url" href="">Download the full log</a>
158 <span class="pull-right">
159 <% if @object.andand.tasks_summary.andand[:failed] and @object.tasks_summary[:failed] > 0 %>
160 <button id="set-show-failed-only" class="btn btn-danger">
161 Show failed task diagnostics only
165 <button id="filter-all" class="btn">
168 <button id="filter-none" class="btn">
174 <input class="search pull-right" style="margin-top: 1em" placeholder="Search" />
177 <div class="radio-inline log-viewer-button" style="margin-left: 10px">
178 <label><input id="sort-by-time" type="radio" name="sort-radio" checked> Sort by time</label>
180 <div class="radio-inline log-viewer-button">
181 <label><input id="sort-by-node" type="radio" name="sort-radio" > Sort by node</label>
184 <div class="radio-inline log-viewer-button">
185 <label><input id="sort-by-task" type="radio" name="sort-radio" > Sort by task</label>
190 <div class="radio-inline log-viewer-button" style="margin-left: 10px">
191 <label><input id="show-all-tasks" type="radio" name="show-tasks-group" checked="true" class="radio-filter"> Show all tasks</label>
193 <div class="radio-inline log-viewer-button">
194 <label><input id="show-successful-tasks" type="radio" name="show-tasks-group" class="radio-filter"> Only successful tasks</label>
196 <div class="radio-inline log-viewer-button">
197 <label><input id="show-failed-tasks" type="radio" name="show-tasks-group" class="radio-filter"> Only failed tasks</label>
202 <div class="checkbox-inline log-viewer-button" style="margin-left: 10px">
203 <label><input id="show-crunch" type="checkbox" checked="true" class="toggle-filter"> Show crunch diagnostics</label>
205 <div class="checkbox-inline log-viewer-button">
206 <label><input id="show-task-dispatch" type="checkbox" checked="true" class="toggle-filter"> Show task dispatch</label>
208 <div class="checkbox-inline log-viewer-button">
209 <label><input id="show-task-print" type="checkbox" checked="true" class="toggle-filter"> Show task diagnostics</label>
211 <div class="checkbox-inline log-viewer-button">
212 <label><input id="show-crunchstat" type="checkbox" checked="true" class="toggle-filter"> Show compute usage</label>
217 <div class="smart-scroll" data-smart-scroll-padding-bottom="50" style="margin-bottom: 0px">
218 <table class="log-viewer-table">
221 <th class="id" data-sort="id"></th>
222 <th class="timestamp" data-sort="timestamp">Timestamp</th>
223 <th class="node" data-sort="node">Node</th>
224 <th class="slot" data-sort="slot">Slot</th>
225 <th class="type" data-sort="type">Log type</th>
226 <th class="taskid" data-sort="taskid">Task</th>
227 <th class="message" data-sort="message">Message</th>
233 <td class="timestamp"></td>
234 <td class="node"></td>
235 <td class="slot"></td>
236 <td class="type"></td>
237 <td class="taskid"></td>
238 <td class="message"></td>
243 <% if @object.log and logcollection %>
244 <div class="spinner spinner-32px"></div>
249 <div class="log-viewer-paging-div" style="margin-bottom: -15px">
250 <a href="#" class="log-viewer-page-up"><span class='glyphicon glyphicon-arrow-up'></span></a>
251 <span class="log-viewer-paging"></span>
252 <a href="#" class="log-viewer-page-down"><span class='glyphicon glyphicon-arrow-down'></span></a>