diff options
author | jadmanski <jadmanski@592f7852-d20e-0410-864c-8624ca9c26a4> | 2008-10-01 14:13:23 +0000 |
---|---|---|
committer | jadmanski <jadmanski@592f7852-d20e-0410-864c-8624ca9c26a4> | 2008-10-01 14:13:23 +0000 |
commit | 3e58fd82b5a3a50fb4422afa4b85d75073a8ea61 (patch) | |
tree | 5794d1a92b9a00da3c10a72cbfc7181f4a28ee08 /tko/parsers | |
parent | 3f1ed09200c644522e805e23ea4dbe5035dfa211 (diff) |
Update the scheduler and the parser to use the new aborted_* attributes that
are written into the database on abort.
Risk: Medium
Visibility: Better error messages from the parser when a job is aborted.
Signed-off-by: John Admanski <jadmanski@google.com>
git-svn-id: svn://test.kernel.org/autotest/trunk@2217 592f7852-d20e-0410-864c-8624ca9c26a4
Diffstat (limited to 'tko/parsers')
-rw-r--r-- | tko/parsers/version_0.py | 10 | ||||
-rw-r--r-- | tko/parsers/version_1.py | 12 |
2 files changed, 15 insertions, 7 deletions
diff --git a/tko/parsers/version_0.py b/tko/parsers/version_0.py index 97de656b..587a01d4 100644 --- a/tko/parsers/version_0.py +++ b/tko/parsers/version_0.py @@ -26,15 +26,17 @@ class job(models.job): finished_time = tko_utils.get_timestamp(keyval, "job_finished") machine_owner = keyval.get("owner", None) + aborted_by = keyval.get("aborted_by", None) + aborted_at = tko_utils.get_timestamp(keyval, "aborted_on") + if not machine: machine = job.find_hostname(dir) tko_utils.dprint("MACHINE NAME: %s" % machine) return {"user": user, "label": label, "machine": machine, - "queued_time": queued_time, - "started_time": started_time, - "finished_time": finished_time, - "machine_owner": machine_owner} + "queued_time": queued_time, "started_time": started_time, + "finished_time": finished_time, "machine_owner": machine_owner, + "aborted_by": aborted_by, "aborted_on": aborted_at} @staticmethod diff --git a/tko/parsers/version_1.py b/tko/parsers/version_1.py index 0aea722f..7312cb6c 100644 --- a/tko/parsers/version_1.py +++ b/tko/parsers/version_1.py @@ -1,4 +1,4 @@ -import os, re +import os, re, time from autotest_lib.tko import models, status_lib, utils as tko_utils from autotest_lib.tko.parsers import base, version_0 @@ -112,7 +112,7 @@ class parser(base.parser): @staticmethod - def make_dummy_abort(indent, subdir, testname, reason="Unexpected ABORT"): + def make_dummy_abort(indent, subdir, testname, reason): indent = "\t" * indent if not subdir: subdir = "----" @@ -150,12 +150,18 @@ class parser(base.parser): # we need to implicitly abort them first tko_utils.dprint('\nUnexpected end of job, aborting') abort_subdir_stack = list(subdir_stack) + if self.job.aborted_by: + reason = "Job aborted by %s" % self.job.aborted_by + reason += self.job.aborted_on.strftime( + " at %b %d %H:%M:%S") + else: + reason = "Job aborted unexpectedly" for i in reversed(xrange(stack.size())): if abort_subdir_stack: subdir = abort_subdir_stack.pop() else: subdir = None - abort = self.make_dummy_abort(i, subdir, subdir) + abort = self.make_dummy_abort(i, subdir, subdir, reason) buffer.put(abort) # stop processing once the buffer is empty |