3 <div id="log_graph_div"
4 class="arv-log-event-listener"
5 data-object-uuid="<%= @object.uuid %>"></div>
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 %>"
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 %>
23 var logViewer = new List('log-viewer', {
24 valueNames: [ 'id', 'timestamp', 'taskid', 'message', 'type'],
28 logViewer.page_offset = 0;
29 logViewer.on("updated", function() { updatePaging(".log-viewer-paging", logViewer, pagesize) } );
30 $(".log-viewer-page-up").on("click", function() { prevPage(logViewer, pagesize, ".log-viewer-paging"); return false; });
31 $(".log-viewer-page-down").on("click", function() { nextPage(logViewer, pagesize, ".log-viewer-paging"); return false; });
33 var taskState = newTaskState();
35 var makeFilter = function() {
37 $(".toggle-filter, .radio-filter").each(function(i, e) {
39 pass.push(e.id.substr(5));
43 return (function(item) {
45 if (item.values().taskid !== "") {
47 if (pass[a] == "all-tasks") { v = true; }
48 else if (pass[a] == "successful-tasks" && taskState[item.values().taskid].outcome == "success") { v = true; }
49 else if (pass[a] == "failed-tasks" && taskState[item.values().taskid].outcome == "failure") { v = true; }
55 if (pass[a] == item.values().type) { return v; }
61 <% if @object.log and !@object.log.empty? %>
62 <% logcollection = Collection.find @object.log %>
63 <% if logcollection %>
64 log_size = <%= logcollection.files[0][2] %>
65 log_maxbytes = <%= Rails.configuration.log_viewer_max_bytes %>;
66 logcollection_url = '<%=j url_for logcollection %>/<%=j logcollection.files[0][1] %>';
67 $("#log-viewer-download-url").attr('href', logcollection_url);
68 $("#log-viewer-download-pane").show();
69 if (log_size > log_maxbytes) {
70 range_header = { 'Range': 'bytes=0-' + log_maxbytes };
74 $.ajax(logcollection_url, { headers: range_header }).
75 done(function(data, status, jqxhr) {
77 addToLogViewer(logViewer, data.split("\n"), taskState);
78 logViewer.filter(makeFilter());
79 content_range_hdr = jqxhr.getResponseHeader('Content-Range');
80 var v = content_range_hdr && content_range_hdr.match(/bytes \d+-(\d+)\/(.+)/);
81 short_log = v && (v[2] == '*' || parseInt(v[1]) + 1 < v[2]);
82 if (jqxhr.status == 206 && short_log) {
83 $("#log-viewer-overview").html(
84 '<p>Showing only ' + data.length + ' bytes of this log.' +
85 ' Timing information is unavailable since' +
86 ' the full log was not retrieved.</p>'
89 generateJobOverview("#log-viewer-overview", logViewer, taskState);
91 $("#log-viewer .spinner").detach();
93 fail(function(jqxhr, status, error) {
94 $("#log-viewer .spinner").detach();
98 <%# Live log loading not implemented yet. %>
101 $(".toggle-filter, .radio-filter").on("change", function() {
102 logViewer.filter(makeFilter());
105 $("#filter-all").on("click", function() {
106 $(".toggle-filter").each(function(i, f) { f.checked = true; });
107 logViewer.filter(makeFilter());
110 $("#filter-none").on("click", function() {
111 $(".toggle-filter").each(function(i, f) { f.checked = false; console.log(f); });
112 logViewer.filter(makeFilter());
115 $("#sort-by-time").on("change", function() {
116 logViewer.sort("id", {sortFunction: sortById});
119 $("#sort-by-task").on("change", function() {
120 logViewer.sort("taskid", {sortFunction: sortByTask});
123 $("#sort-by-node").on("change", function() {
124 logViewer.sort("node", {sortFunction: sortByNode});
127 $("#set-show-failed-only").on("click", function() {
128 $("#sort-by-task").prop("checked", true);
129 $("#show-failed-tasks").prop("checked", true);
130 $("#show-crunch").prop("checked", false);
131 $("#show-task-dispatch").prop("checked", true);
132 $("#show-script-print").prop("checked", true);
133 $("#show-crunchstat").prop("checked", false);
134 logViewer.filter(makeFilter());
135 logViewer.sort("taskid", {sortFunction: sortByTask});
142 <div id="log-viewer">
145 <p id="log-viewer-overview">
146 <% if !logcollection %>
147 The collection containing the job log was not found.
151 <p id="log-viewer-download-pane" style="display:none">
152 <a id="log-viewer-download-url" href="">Download the full log</a>
157 <span class="pull-right">
158 <% if @object.andand.tasks_summary.andand[:failed] and @object.tasks_summary[:failed] > 0 %>
159 <button id="set-show-failed-only" class="btn btn-danger">
160 Show failed task diagnostics only
164 <button id="filter-all" class="btn">
167 <button id="filter-none" class="btn">
173 <input class="search pull-right" style="margin-top: 1em" placeholder="Search" />
176 <div class="radio-inline log-viewer-button" style="margin-left: 10px">
177 <label><input id="sort-by-time" type="radio" name="sort-radio" checked> Sort by time</label>
179 <div class="radio-inline log-viewer-button">
180 <label><input id="sort-by-node" type="radio" name="sort-radio" > Sort by node</label>
183 <div class="radio-inline log-viewer-button">
184 <label><input id="sort-by-task" type="radio" name="sort-radio" > Sort by task</label>
189 <div class="radio-inline log-viewer-button" style="margin-left: 10px">
190 <label><input id="show-all-tasks" type="radio" name="show-tasks-group" checked="true" class="radio-filter"> Show all tasks</label>
192 <div class="radio-inline log-viewer-button">
193 <label><input id="show-successful-tasks" type="radio" name="show-tasks-group" class="radio-filter"> Only successful tasks</label>
195 <div class="radio-inline log-viewer-button">
196 <label><input id="show-failed-tasks" type="radio" name="show-tasks-group" class="radio-filter"> Only failed tasks</label>
201 <div class="checkbox-inline log-viewer-button" style="margin-left: 10px">
202 <label><input id="show-crunch" type="checkbox" checked="true" class="toggle-filter"> Show crunch diagnostics</label>
204 <div class="checkbox-inline log-viewer-button">
205 <label><input id="show-task-dispatch" type="checkbox" checked="true" class="toggle-filter"> Show task dispatch</label>
207 <div class="checkbox-inline log-viewer-button">
208 <label><input id="show-task-print" type="checkbox" checked="true" class="toggle-filter"> Show task diagnostics</label>
210 <div class="checkbox-inline log-viewer-button">
211 <label><input id="show-crunchstat" type="checkbox" checked="true" class="toggle-filter"> Show compute usage</label>
216 <div class="smart-scroll" data-smart-scroll-padding-bottom="50" style="margin-bottom: 0px">
217 <table class="log-viewer-table">
220 <th class="id" data-sort="id"></th>
221 <th class="timestamp" data-sort="timestamp">Timestamp</th>
222 <th class="node" data-sort="node">Node</th>
223 <th class="slot" data-sort="slot">Slot</th>
224 <th class="type" data-sort="type">Log type</th>
225 <th class="taskid" data-sort="taskid">Task</th>
226 <th class="message" data-sort="message">Message</th>
232 <td class="timestamp"></td>
233 <td class="node"></td>
234 <td class="slot"></td>
235 <td class="type"></td>
236 <td class="taskid"></td>
237 <td class="message"></td>
242 <% if @object.log and logcollection %>
243 <div class="spinner spinner-32px"></div>
248 <div class="log-viewer-paging-div" style="margin-bottom: -15px">
249 <a href="#" class="log-viewer-page-up"><span class='glyphicon glyphicon-arrow-up'></span></a>
250 <span class="log-viewer-paging"></span>
251 <a href="#" class="log-viewer-page-down"><span class='glyphicon glyphicon-arrow-down'></span></a>