3 <% log_history = stderr_log_history([@object.uuid]) %>
5 <div class="arv-log-event-listener arv-log-event-handler-append-logs arv-job-log-window" id="pipeline_event_log_div" data-object-uuid="<%= @object.uuid %>"><%= log_history.join("\n") %>
14 var logViewer = new List('log-viewer', {
15 valueNames: [ 'id', 'timestamp', 'taskid', 'message', 'type'],
19 logViewer.page_offset = 0;
20 logViewer.on("updated", function() { updatePaging(".log-viewer-paging", logViewer, pagesize) } );
21 $(".log-viewer-page-up").on("click", function() { prevPage(logViewer, pagesize, ".log-viewer-paging"); return false; });
22 $(".log-viewer-page-down").on("click", function() { nextPage(logViewer, pagesize, ".log-viewer-paging"); return false; });
24 var taskState = newTaskState();
26 var makeFilter = function() {
28 $(".toggle-filter, .radio-filter").each(function(i, e) {
30 pass.push(e.id.substr(5));
34 return (function(item) {
36 if (item.values().taskid !== "") {
38 if (pass[a] == "all-tasks") { v = true; }
39 else if (pass[a] == "successful-tasks" && taskState[item.values().taskid].outcome == "success") { v = true; }
40 else if (pass[a] == "failed-tasks" && taskState[item.values().taskid].outcome == "failure") { v = true; }
46 if (pass[a] == item.values().type) { return v; }
53 <% logcollection = Collection.find @object.log %>
54 <% if logcollection %>
55 log_size = <%= logcollection.files[0][2] %>
56 log_maxbytes = <%= Rails.configuration.log_viewer_max_bytes %>;
57 logcollection_url = '<%=j url_for logcollection %>/<%=j logcollection.files[0][1] %>';
58 $("#log-viewer-download-url").attr('href', logcollection_url);
59 $("#log-viewer-download-pane").show();
60 if (log_size > log_maxbytes) {
61 range_header = { 'Range': 'bytes=0-' + log_maxbytes };
65 $.ajax(logcollection_url, { headers: range_header }).
66 done(function(data, status, jqxhr) {
68 addToLogViewer(logViewer, data.split("\n"), taskState);
69 logViewer.filter(makeFilter());
70 content_range_hdr = jqxhr.getResponseHeader('Content-Range');
71 var v = content_range_hdr && content_range_hdr.match(/bytes \d+-(\d+)\/(.+)/);
72 short_log = v && (v[2] == '*' || parseInt(v[1]) + 1 < v[2]);
73 if (jqxhr.status == 206 && short_log) {
74 $("#log-viewer-overview").html(
75 '<p>Showing only ' + data.length + ' bytes of this log.' +
76 ' Timing information is unavailable since' +
77 ' the full log was not retrieved.</p>'
80 generateJobOverview("#log-viewer-overview", logViewer, taskState);
82 $("#log-viewer .spinner").detach();
84 fail(function(jqxhr, status, error) {
85 $("#log-viewer .spinner").detach();
89 <%# Live log loading not implemented yet. %>
92 $(".toggle-filter, .radio-filter").on("change", function() {
93 logViewer.filter(makeFilter());
96 $("#filter-all").on("click", function() {
97 $(".toggle-filter").each(function(i, f) { f.checked = true; });
98 logViewer.filter(makeFilter());
101 $("#filter-none").on("click", function() {
102 $(".toggle-filter").each(function(i, f) { f.checked = false; console.log(f); });
103 logViewer.filter(makeFilter());
106 $("#sort-by-time").on("change", function() {
107 logViewer.sort("id", {sortFunction: sortById});
110 $("#sort-by-task").on("change", function() {
111 logViewer.sort("taskid", {sortFunction: sortByTask});
114 $("#sort-by-node").on("change", function() {
115 logViewer.sort("node", {sortFunction: sortByNode});
118 $("#set-show-failed-only").on("click", function() {
119 $("#sort-by-task").prop("checked", true);
120 $("#show-failed-tasks").prop("checked", true);
121 $("#show-crunch").prop("checked", false);
122 $("#show-task-dispatch").prop("checked", true);
123 $("#show-script-print").prop("checked", true);
124 $("#show-crunchstat").prop("checked", false);
125 logViewer.filter(makeFilter());
126 logViewer.sort("taskid", {sortFunction: sortByTask});
133 <div id="log-viewer">
136 <p id="log-viewer-overview">
137 <% if !logcollection %>
138 The collection containing the job log was not found.
142 <p id="log-viewer-download-pane" style="display:none">
143 <a id="log-viewer-download-url" href="">Download the full log</a>
148 <span class="pull-right">
149 <% if @object.andand.tasks_summary.andand[:failed] and @object.tasks_summary[:failed] > 0 %>
150 <button id="set-show-failed-only" class="btn btn-danger">
151 Show failed task diagnostics only
155 <button id="filter-all" class="btn">
158 <button id="filter-none" class="btn">
164 <input class="search pull-right" style="margin-top: 1em" placeholder="Search" />
167 <div class="radio-inline log-viewer-button" style="margin-left: 10px">
168 <label><input id="sort-by-time" type="radio" name="sort-radio" checked> Sort by time</label>
170 <div class="radio-inline log-viewer-button">
171 <label><input id="sort-by-node" type="radio" name="sort-radio" > Sort by node</label>
174 <div class="radio-inline log-viewer-button">
175 <label><input id="sort-by-task" type="radio" name="sort-radio" > Sort by task</label>
180 <div class="radio-inline log-viewer-button" style="margin-left: 10px">
181 <label><input id="show-all-tasks" type="radio" name="show-tasks-group" checked="true" class="radio-filter"> Show all tasks</label>
183 <div class="radio-inline log-viewer-button">
184 <label><input id="show-successful-tasks" type="radio" name="show-tasks-group" class="radio-filter"> Only successful tasks</label>
186 <div class="radio-inline log-viewer-button">
187 <label><input id="show-failed-tasks" type="radio" name="show-tasks-group" class="radio-filter"> Only failed tasks</label>
192 <div class="checkbox-inline log-viewer-button" style="margin-left: 10px">
193 <label><input id="show-crunch" type="checkbox" checked="true" class="toggle-filter"> Show crunch diagnostics</label>
195 <div class="checkbox-inline log-viewer-button">
196 <label><input id="show-task-dispatch" type="checkbox" checked="true" class="toggle-filter"> Show task dispatch</label>
198 <div class="checkbox-inline log-viewer-button">
199 <label><input id="show-task-print" type="checkbox" checked="true" class="toggle-filter"> Show task diagnostics</label>
201 <div class="checkbox-inline log-viewer-button">
202 <label><input id="show-crunchstat" type="checkbox" checked="true" class="toggle-filter"> Show compute usage</label>
207 <div class="smart-scroll" data-smart-scroll-padding-bottom="50" style="margin-bottom: 0px">
208 <table class="log-viewer-table">
211 <th class="id" data-sort="id"></th>
212 <th class="timestamp" data-sort="timestamp">Timestamp</th>
213 <th class="node" data-sort="node">Node</th>
214 <th class="slot" data-sort="slot">Slot</th>
215 <th class="type" data-sort="type">Log type</th>
216 <th class="taskid" data-sort="taskid">Task</th>
217 <th class="message" data-sort="message">Message</th>
223 <td class="timestamp"></td>
224 <td class="node"></td>
225 <td class="slot"></td>
226 <td class="type"></td>
227 <td class="taskid"></td>
228 <td class="message"></td>
233 <% if @object.log and logcollection %>
234 <div class="spinner spinner-32px"></div>
239 <div class="log-viewer-paging-div" style="margin-bottom: -15px">
240 <a href="#" class="log-viewer-page-up"><span class='glyphicon glyphicon-arrow-up'></span></a>
241 <span class="log-viewer-paging"></span>
242 <a href="#" class="log-viewer-page-down"><span class='glyphicon glyphicon-arrow-down'></span></a>