Risk: Low
Visibility: Should eliminate test failures caused by problems inserting results
into the tko database.
This wraps all of the insert_test calls used for the continuous parsing in a
try-except handler that logs a warning to stderr that the insert failed, but
continues running anyway. In the case of intermittent database issues, this
will prevent long-runnings tests from failing part-way through just because of
a problem saving the result.
A full parse of the results is still performed when the job completes, so the
results will eventually make it into the database, but given the choice between
the continuous parsing producing temporary incomplete results and an aborted
job, it seems better to just continue with the job.
Signed-off-by: John Admanski <jadmanski@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@1536 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/server/server_job.py b/server/server_job.py
index 40fb82b..388ad45 100755
--- a/server/server_job.py
+++ b/server/server_job.py
@@ -220,7 +220,7 @@
return
final_tests = self.parser.end()
for test in final_tests:
- self.results_db.insert_test(self.job_model, test)
+ self.__insert_test(test)
self.using_parser = False
@@ -574,7 +574,21 @@
return
new_tests = self.parser.process_lines(new_lines)
for test in new_tests:
+ self.__insert_test(test)
+
+
+ def __insert_test(self, test):
+ """ An internal method to insert a new test result into the
+ database. This method will not raise an exception, even if an
+ error occurs during the insert, to avoid failing a test
+ simply because of unexpected database issues."""
+ try:
self.results_db.insert_test(self.job_model, test)
+ except Exception:
+ msg = ("WARNING: An unexpected error occured while "
+ "inserting test results into the database. "
+ "Ignoring error.\n" + traceback.format_exc())
+ print >> sys.stderr, msg
# a file-like object for catching stderr from an autotest client and