Add a site_monitor_db_babysitter module.  If found, it will use its
SiteMonitorProc as a base class for MonitorProc so that site code can
override the monitor_db arguments and/or setup environment variables
needed for the scheduler to run properly at the given site.

Signed-off-by: Gregory Smith <[email protected]>

--- autotest/scheduler/monitor_db_babysitter    2010-02-16 19:01:33.000000000 
-0800
+++ autotest/scheduler/monitor_db_babysitter    2010-02-16 19:01:33.000000000 
-0800
@@ -65,7 +65,12 @@
 signal.signal(signal.SIGTERM, handle_sigterm)
 
 
-class MonitorProc:
+SiteMonitorProc = utils.import_site_class(
+    __file__, 'autotest_lib.scheduler.site_monitor_db_babysitter',
+    'SiteMonitorProc', object)
+
+
+class MonitorProc(SiteMonitorProc):
     def __init__(self, do_recovery=False):
         args = [monitor_db_path]
         if do_recovery:
@@ -84,8 +89,16 @@
         self.last_log_change = time.time()
 
         logging.info("STARTING monitor_db with log file %s" % self.log_path)
+        self.args = args
+
+        # Allow site specific code to run, set environment variables and
+        # modify self.args if desired.
+        super(MonitorProc, self).__init__()
+
+
+    def start(self):
         devnull = open(os.devnull, 'w')
-        self.proc = subprocess.Popen(args, stdout=devnull)
+        self.proc = subprocess.Popen(self.args, stdout=devnull)
 
 
     def is_running(self):
@@ -142,6 +155,7 @@
 
 while True:
     proc = MonitorProc(do_recovery=recover)
+    proc.start()
     time.sleep(PAUSE_LENGTH)
     while proc.is_running():
         logging.info("Tick")
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to