v11 = v[11];
if (typeof v[11] === 'undefined') {
- v11 = ' ';
+ v11 = "";
+ } else {
+ v11 = Number(v11);
}
var message = v[12];
var type = "";
- if (v11 != ' ') {
+ if (v11 !== "") {
if (/^stderr /.test(message)) {
message = message.substr(7);
if (/^crunchstat: /.test(message)) {
type = "task-output";
}
} else {
- if (/^success in (\d+)/) {
+ if (/^success in (\d+)/.test(message)) {
taskState[v11] = "success";
}
- if (/^failure \([^)]+\) (\d+)/) {
+ if (/^failure \([^)]+\) (\d+)/.test(message)) {
taskState[v11] = "failure";
}
type = "task-dispatch";
}
logViewer.update();
}
+
+function sortByTaskThenId(a, b, opt) {
+ a = a.values();
+ b = b.values();
+
+ if (a["taskid"] === "" && b["taskid"] !== "") {
+ return -1;
+ }
+ if (a["taskid"] !== "" && b["taskid"] === "") {
+ return 1;
+ }
+
+ if (a["taskid"] !== "" && b["taskid"] !== "") {
+ if (a["taskid"] > b["taskid"]) {
+ return 1;
+ }
+ if (a["taskid"] < b["taskid"]) {
+ return -1;
+ }
+ }
+
+ if (a["id"] > b["id"]) {
+ return 1;
+ }
+ if (a["id"] < b["id"]) {
+ return -1;
+ }
+ return 0;
+}
page: 10000,
});
+var taskState = {};
+
var makeFilter = function() {
var pass = [];
$(".toggle-filter").each(function(i, e) {
pass.push(e.id.substr(5));
}
});
+
return (function(item) {
+ var v = false;
+ if (item.values().taskid !== "") {
+ for (a in pass) {
+ if (pass[a] == "successful-tasks" && taskState[item.values().taskid] == "success") { v = true; }
+ if (pass[a] == "failed-tasks" && taskState[item.values().taskid] == "failure") { v = true; }
+ }
+ } else {
+ v = true;
+ }
for (a in pass) {
- if (pass[a] == item.values().type) { return true; }
+ if (pass[a] == item.values().type) { return v; }
}
return false;
});
$.ajax('<%=j url_for logcollection %>/<%=j logcollection.files[0][1] %>').
done(function(data, status, jqxhr) {
logViewer.filter();
- addToLogViewer(logViewer, data.split("\n"));
+ addToLogViewer(logViewer, data.split("\n"), taskState);
logViewer.filter(makeFilter());
$("#logloadspinner").detach();
});
});
$("#sort-by-task").on("change", function() {
- logViewer.sort("taskid");
+ logViewer.sort("taskid", {sortFunction: sortByTaskThenId});
});
})();
<label><input id="sort-by-task" type="radio" name="sort-radio" > Sort by task</label>
</div>
-<br>
- <div class="radio-inline">
- <label><input id="filter-tasks-all" type="radio" name="tasks-radio" checked> Show all tasks</label>
- </div>
- <div class="radio-inline">
- <label><input id="filter-tasks-successes" type="radio" name="tasks-radio" > Show successes only</label>
- </div>
- <div class="radio-inline">
- <label><input id="filter-tasks-failures" type="radio" name="tasks-radio" > Show failures only</label>
- </div>
-<br>
<div class="checkbox-inline">
<label><input id="show-crunch" type="checkbox" checked="true" class="toggle-filter"> Show crunch output</label>
</div>
<div class="checkbox-inline">
<label><input id="show-crunchstat" type="checkbox" checked="true" class="toggle-filter"> Show compute usage</label>
</div>
+ <div class="checkbox-inline">
+ <label><input id="show-successful-tasks" type="checkbox" checked="true" class="toggle-filter"> Show successful tasks</label>
+ </div>
+ <div class="checkbox-inline">
+ <label><input id="show-failed-tasks" type="checkbox" checked="true" class="toggle-filter"> Show failed tasks</label>
+ </div>
<div class="pull-right">
<button id="filter-all" class="btn">