summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4>2009-05-13 20:42:17 +0000
committermbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4>2009-05-13 20:42:17 +0000
commitb88c087878ed1913ac9db83633aaa3e720ff2de1 (patch)
treeb5320d2868eab0ca569e548c3c213f1252a0f683
parent515ba81d7fffa34ef0de6cfc0b661a2cadc4e63f (diff)
Add post-parse site hooks (parse -P to trigger, default = off)
Make scheduler call tko/parse with -P Signed-off-by: Rachel Kroll <rkroll@google.com> git-svn-id: svn://test.kernel.org/autotest/trunk@3123 592f7852-d20e-0410-864c-8624ca9c26a4
-rwxr-xr-xscheduler/monitor_db.py2
-rwxr-xr-xtko/parse.py15
2 files changed, 16 insertions, 1 deletions
diff --git a/scheduler/monitor_db.py b/scheduler/monitor_db.py
index d6466bfb..5d468d60 100755
--- a/scheduler/monitor_db.py
+++ b/scheduler/monitor_db.py
@@ -1913,7 +1913,7 @@ class FinalReparseTask(PostJobTask):
def _generate_command(self, results_dir):
- return [_parser_path, '--write-pidfile', '-l', '2', '-r', '-o',
+ return [_parser_path, '--write-pidfile', '-l', '2', '-r', '-o', '-P',
results_dir]
diff --git a/tko/parse.py b/tko/parse.py
index 40cb77f6..a832a36d 100755
--- a/tko/parse.py
+++ b/tko/parse.py
@@ -5,6 +5,7 @@ import os, sys, optparse, fcntl, errno, traceback, socket
import common
from autotest_lib.client.common_lib import mail, pidfile
from autotest_lib.tko import db as tko_db, utils as tko_utils, status_lib, models
+from autotest_lib.client.common_lib import utils
def parse_args():
@@ -29,6 +30,8 @@ def parse_args():
action="store")
parser.add_option("-d", help="Database name", dest="db_name",
action="store")
+ parser.add_option("-P", help="Run site post-processing",
+ dest="site_do_post", action="store_true", default=False)
parser.add_option("--write-pidfile",
help="write pidfile (.parser_execute)",
dest="write_pidfile", action="store_true",
@@ -230,6 +233,10 @@ def parse_path(db, path, level, reparse, mail_on_failure):
parse_leaf_path(db, path, level, reparse, mail_on_failure)
+def _site_post_parse_job_dummy():
+ return {}
+
+
def main():
options, args = parse_args()
results_dir = os.path.abspath(args[0])
@@ -240,6 +247,10 @@ def main():
if options.write_pidfile:
pid_file_manager.open_file()
+ site_post_parse_job = utils.import_site_function(__file__,
+ "autotest_lib.tko.site_parse", "site_post_parse_job",
+ _site_post_parse_job_dummy)
+
try:
# build up the list of job dirs to parse
if options.singledir:
@@ -271,6 +282,10 @@ def main():
try:
parse_path(db, path, options.level, options.reparse,
options.mailit)
+
+ if options.site_do_post is True:
+ site_post_parse_job(path)
+
finally:
fcntl.flock(lockfile, fcntl.LOCK_UN)
lockfile.close()