+<% if !@object.log %>
+
+<div id="log_graph_div"
+ class="arv-log-event-listener"
+ style="display:none"
+ data-object-uuid="<%= @object.uuid %>"></div>
+
+<div id="event_log_div"
+ class="arv-log-event-listener arv-log-event-handler-append-logs arv-job-log-window"
+ data-object-uuid="<%= @object.uuid %>"
+ ></div>
+
+<%# Applying a long throttle suppresses the auto-refresh of this
+ partial that would normally be triggered by arv-log-event. %>
+<div class="arv-log-refresh-control"
+ data-load-throttle="86486400000" <%# 1001 nights %>
+ ></div>
+
+<% else %>
+
<script>
(function() {
var pagesize = 1000;
var makeFilter = function() {
var pass = [];
- $(".toggle-filter").each(function(i, e) {
+ $(".toggle-filter, .radio-filter").each(function(i, e) {
if (e.checked) {
pass.push(e.id.substr(5));
}
});
}
-<% if @object.log %>
-<% logcollection = Collection.find @object.log %>
-
-$.ajax('<%=j url_for logcollection %>/<%=j logcollection.files[0][1] %>').
- done(function(data, status, jqxhr) {
- logViewer.filter();
- addToLogViewer(logViewer, data.split("\n"), taskState);
- logViewer.filter(makeFilter());
- generateJobOverview("#log-viewer-overview", logViewer, taskState);
- $("#logloadspinner").detach();
- });
+<% if @object.log and !@object.log.empty? %>
+ <% logcollection = Collection.find @object.log %>
+ <% if logcollection %>
+ log_size = <%= logcollection.files[0][2] %>
+ log_maxbytes = <%= Rails.configuration.log_viewer_max_bytes %>;
+ logcollection_url = '<%=j url_for logcollection %>/<%=j logcollection.files[0][1] %>';
+ $("#log-viewer-download-url").attr('href', logcollection_url);
+ $("#log-viewer-download-pane").show();
+ if (log_size > log_maxbytes) {
+ range_header = { 'Range': 'bytes=0-' + log_maxbytes };
+ } else {
+ range_header = null;
+ }
+ $.ajax(logcollection_url, { headers: range_header }).
+ done(function(data, status, jqxhr) {
+ logViewer.filter();
+ addToLogViewer(logViewer, data.split("\n"), taskState);
+ logViewer.filter(makeFilter());
+ content_range_hdr = jqxhr.getResponseHeader('Content-Range');
+ var v = content_range_hdr && content_range_hdr.match(/bytes \d+-(\d+)\/(.+)/);
+ short_log = v && (v[2] == '*' || parseInt(v[1]) + 1 < v[2]);
+ if (jqxhr.status == 206 && short_log) {
+ $("#log-viewer-overview").html(
+ '<p>Showing only ' + data.length + ' bytes of this log.' +
+ ' Timing information is unavailable since' +
+ ' the full log was not retrieved.</p>'
+ );
+ } else {
+ generateJobOverview("#log-viewer-overview", logViewer, taskState);
+ }
+ $("#log-viewer .spinner").detach();
+ }).
+ fail(function(jqxhr, status, error) {
+ $("#log-viewer .spinner").detach();
+ });
+ <% end %>
<% else %>
<%# Live log loading not implemented yet. %>
<% end %>
-$(".toggle-filter").on("change", function() {
+$(".toggle-filter, .radio-filter").on("change", function() {
logViewer.filter(makeFilter());
});
$("#filter-none").on("click", function() {
$(".toggle-filter").each(function(i, f) { f.checked = false; console.log(f); });
- $("#show-all-tasks").prop("checked", true);
logViewer.filter(makeFilter());
});
$("#show-failed-tasks").prop("checked", true);
$("#show-crunch").prop("checked", false);
$("#show-task-dispatch").prop("checked", true);
- $("#show-task-output").prop("checked", true);
+ $("#show-script-print").prop("checked", true);
$("#show-crunchstat").prop("checked", false);
logViewer.filter(makeFilter());
logViewer.sort("taskid", {sortFunction: sortByTask});
<div id="log-viewer">
<h3>Summary</h3>
- <div id="log-viewer-overview"></div>
+ <p id="log-viewer-overview">
+ <% if !logcollection %>
+ The collection containing the job log was not found.
+ <% end %>
+ </p>
- <% if @object.tasks_summary[:failed] > 0 %>
- <button id="set-show-failed-only" class="btn btn-danger" style="margin-top: 1em">
- Show failed task output only
- </button>
- <% end %>
+ <p id="log-viewer-download-pane" style="display:none">
+ <a id="log-viewer-download-url" href="">Download the full log</a>
+ </p>
<div class="h3">Log
<span class="pull-right">
+ <% if @object.andand.tasks_summary.andand[:failed] and @object.tasks_summary[:failed] > 0 %>
+ <button id="set-show-failed-only" class="btn btn-danger">
+ Show failed task diagnostics only
+ </button>
+ <% end %>
+
<button id="filter-all" class="btn">
Select all
</button>
<div>
<div class="radio-inline log-viewer-button" style="margin-left: 10px">
- <label><input id="show-all-tasks" type="radio" name="show-tasks-group" checked="true" class="toggle-filter"> Show all tasks</label>
+ <label><input id="show-all-tasks" type="radio" name="show-tasks-group" checked="true" class="radio-filter"> Show all tasks</label>
</div>
<div class="radio-inline log-viewer-button">
- <label><input id="show-successful-tasks" type="radio" name="show-tasks-group" class="toggle-filter"> Only successful tasks</label>
+ <label><input id="show-successful-tasks" type="radio" name="show-tasks-group" class="radio-filter"> Only successful tasks</label>
</div>
<div class="radio-inline log-viewer-button">
- <label><input id="show-failed-tasks" type="radio" name="show-tasks-group" class="toggle-filter"> Only failed tasks</label>
+ <label><input id="show-failed-tasks" type="radio" name="show-tasks-group" class="radio-filter"> Only failed tasks</label>
</div>
</div>
<div>
<div class="checkbox-inline log-viewer-button" style="margin-left: 10px">
- <label><input id="show-crunch" type="checkbox" checked="true" class="toggle-filter"> Show crunch output</label>
+ <label><input id="show-crunch" type="checkbox" checked="true" class="toggle-filter"> Show crunch diagnostics</label>
</div>
<div class="checkbox-inline log-viewer-button">
<label><input id="show-task-dispatch" type="checkbox" checked="true" class="toggle-filter"> Show task dispatch</label>
</div>
<div class="checkbox-inline log-viewer-button">
- <label><input id="show-task-output" type="checkbox" checked="true" class="toggle-filter"> Show task output</label>
+ <label><input id="show-task-print" type="checkbox" checked="true" class="toggle-filter"> Show task diagnostics</label>
</div>
<div class="checkbox-inline log-viewer-button">
<label><input id="show-crunchstat" type="checkbox" checked="true" class="toggle-filter"> Show compute usage</label>
</div>
- <div class="log-viewer-paging-div">
- <a href="#" class="log-viewer-page-up"><span class='glyphicon glyphicon-arrow-up'></span></a>
- <span class="log-viewer-paging"></span>
- <a href="#" class="log-viewer-page-down"><span class='glyphicon glyphicon-arrow-down'></span></a>
+ <div class="smart-scroll" data-smart-scroll-padding-bottom="50" style="margin-bottom: 0px">
+ <table class="log-viewer-table">
+ <thead>
+ <tr>
+ <th class="id" data-sort="id"></th>
+ <th class="timestamp" data-sort="timestamp">Timestamp</th>
+ <th class="node" data-sort="node">Node</th>
+ <th class="slot" data-sort="slot">Slot</th>
+ <th class="type" data-sort="type">Log type</th>
+ <th class="taskid" data-sort="taskid">Task</th>
+ <th class="message" data-sort="message">Message</th>
+ </tr>
+ </thead>
+ <tbody class="list">
+ <tr>
+ <td class="id"></td>
+ <td class="timestamp"></td>
+ <td class="node"></td>
+ <td class="slot"></td>
+ <td class="type"></td>
+ <td class="taskid"></td>
+ <td class="message"></td>
+ </tr>
+ </tbody>
+ </table>
+
+ <% if @object.log and logcollection %>
+ <div class="spinner spinner-32px"></div>
+ <% end %>
+
</div>
- <table class="log-viewer-table">
- <thead>
- <tr>
- <th class="id" data-sort="id"></th>
- <th class="timestamp" data-sort="timestamp">Timestamp</th>
- <th class="node" data-sort="node">Node</th>
- <th class="slot" data-sort="slot">Slot</th>
- <th class="type" data-sort="type">Log type</th>
- <th class="taskid" data-sort="taskid">Task</th>
- <th class="message" data-sort="message">Message</th>
- </tr>
- </thead>
- <tbody class="list">
- <tr>
- <td class="id"></td>
- <td class="timestamp"></td>
- <td class="node"></td>
- <td class="slot"></td>
- <td class="type"></td>
- <td class="taskid"></td>
- <td class="message"></td>
- </tr>
- </tbody>
- </table>
-
-
- <div style="font-size: 18px">
+ <div class="log-viewer-paging-div" style="margin-bottom: -15px">
<a href="#" class="log-viewer-page-up"><span class='glyphicon glyphicon-arrow-up'></span></a>
<span class="log-viewer-paging"></span>
<a href="#" class="log-viewer-page-down"><span class='glyphicon glyphicon-arrow-down'></span></a>
</div>
-
</div>
-<% if !@object.log %>
- This job is still running. The job log will be available when the job is complete.
<% end %>
-
-<%= image_tag 'ajax-loader.gif', id: "logloadspinner" %>