Mark finished jobs as finished on dashboard

This commit is contained in:
Ivan Kozik 2015-07-19 20:42:29 +00:00
parent 8e2e1c5f58
commit 7566de05e3
2 changed files with 9 additions and 15 deletions

View File

@ -979,31 +979,19 @@ JobsRenderer.prototype._renderStdoutLine = function(data, logSegment, info, iden
logSegment.appendChild(h("div", Reusable.obj_className_line_stdout, line));
renderedLines += 1;
// Check for 'Finished RsyncUpload for Item'
// instead of 'Starting MarkItemAsDone for Item'
// because the latter is often missing
if(/^Finished RsyncUpload for Item/.test(line)) {
if(/^Finished grab \S+ \S+ with exit code (0|1)$/.test(line)) {
info.statsElements.jobInfo.classList.add('job-info-done');
this.jobs.markFinished(ident);
} else if(/^CRITICAL (Sorry|Please report)|^ERROR Fatal exception|No space left on device|^Fatal Python error:|^(Thread|Current thread) 0x/.test(line)) {
} else if(/^Finished grab \S+ \S+ with exit code |^CRITICAL (Sorry|Please report)|^ERROR Fatal exception|No space left on device|^Fatal Python error:|^(Thread|Current thread) 0x/.test(line)) {
info.statsElements.jobInfo.classList.add('job-info-fatal');
this.jobs.markFatalException(ident);
} else if(/Script requested immediate stop|^Adjusted target WARC path to.*-aborted$/.test(line)) {
} else if(/Script requested immediate stop/.test(line)) {
// Note: above message can be in:
// ERROR Script requested immediate stop
// or after an ERROR Fatal exception:
// wpull.hook.HookStop: Script requested immediate stop.
//
// Also check for "Adjusted target WARC path" because
// the exception may be entirely missing.
info.statsElements.jobInfo.classList.remove('job-info-fatal');
info.statsElements.jobInfo.classList.add('job-info-aborted');
} else if(/^Received item /.test(line)) {
// Clear other statuses if a job restarts with the same job ID
info.statsElements.jobInfo.classList.remove('job-info-done');
info.statsElements.jobInfo.classList.remove('job-info-fatal');
info.statsElements.jobInfo.classList.remove('job-info-aborted');
this.jobs.markUnfinished(ident);
}
}
return renderedLines;

View File

@ -315,6 +315,11 @@ sys.stdout.buffer.write = stdoutWriteToBoth
sys.stderr.buffer.write = stderrWriteToBoth
def exitStatus(code):
print("Finished grab {} {} with exit code {}".format(jobData["ident"], jobData["url"], code))
return code
assert 2 in wpull_hook.callbacks.AVAILABLE_VERSIONS
wpull_hook.callbacks.version = 2
@ -324,3 +329,4 @@ wpull_hook.callbacks.dequeued_url = dequeuedURL
wpull_hook.callbacks.handle_response = handleResponse
wpull_hook.callbacks.handle_error = handleError
wpull_hook.callbacks.handle_pre_response = handlePreResponse
wpull_hook.callbacks.exit_status = exitStatus