|
@@ -25,9 +25,44 @@ function getLogPath(type, id) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+function logHeader(name) {
|
|
|
+ return "<h4><div data-toggle='tooltip' data-placement='right' "
|
|
|
+ + "title='Only the most recent log lines are displayed "
|
|
|
+ + "(max log lines is set by the livy.cache-log.size config)'>"
|
|
|
+ + name + "</div></h4>";
|
|
|
+}
|
|
|
+
|
|
|
function parseLog(logLines) {
|
|
|
- // TODO: [LIVY-387]: Separate out stdout, stderr, and YARN Diagnostics into different viewers
|
|
|
- return preWrap(logLines.join("\n"));
|
|
|
+ // display non-standard log formats
|
|
|
+ if (!logLines[0].startsWith("stdout")) {
|
|
|
+ return preWrap(logLines.join("\n"));
|
|
|
+ }
|
|
|
+
|
|
|
+ var stderrIndex = 0;
|
|
|
+ var stdoutLines = logLines;
|
|
|
+ var stderrLines = [];
|
|
|
+ var yarnDiagLines = null;
|
|
|
+
|
|
|
+ for (var i = 1; i < logLines.length; i++) {
|
|
|
+ if (stderrIndex == 0 && logLines[i].startsWith("\nstderr")) {
|
|
|
+ stdoutLines = logLines.slice(1, i);
|
|
|
+ stderrLines = logLines.slice(i, logLines.length);
|
|
|
+ stderrIndex = i;
|
|
|
+ } else if (logLines[i].startsWith("\nYARN Diagnostics")) {
|
|
|
+ stderrLines = logLines.slice(stderrIndex + 1, i);
|
|
|
+ yarnDiagLines = logLines.slice(i + 1, logLines.length);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ var stdoutLog = logHeader("stdout") + preWrap(stdoutLines.join("\n"));
|
|
|
+ var stderrLog = logHeader("stderr") + preWrap(stderrLines.join("\n"));
|
|
|
+ var yarnDiagLog = "";
|
|
|
+ if (yarnDiagLines != null) {
|
|
|
+ yarnDiagLog = "<h4>YARN Diagnostics</h4>" + preWrap(yarnDiagLines.join("\n"));
|
|
|
+ }
|
|
|
+
|
|
|
+ return stdoutLog + stderrLog + yarnDiagLog;
|
|
|
}
|
|
|
|
|
|
$(document).ready(function () {
|
|
@@ -38,6 +73,10 @@ $(document).ready(function () {
|
|
|
$.getJSON(location.origin + getLogPath(type, id), {size: -1}, function(response) {
|
|
|
if (response) {
|
|
|
$("#session-log").append(parseLog(response.log));
|
|
|
+ $('#session-log [data-toggle="tooltip"]').tooltip();
|
|
|
+ $("#session-log pre").each(function () {
|
|
|
+ $(this).scrollTop($(this)[0].scrollHeight);
|
|
|
+ });
|
|
|
}
|
|
|
});
|
|
|
});
|