Add some site-specific parsing utilities.

Signed-off-by: James Ren <[email protected]>

--- autotest/scheduler/drone_utility.py 2010-05-11 10:35:33.000000000 -0700
+++ autotest/scheduler/drone_utility.py 2010-09-27 13:30:21.000000000 -0700
@@ -103,13 +103,15 @@
                 for line_components in split_lines)
 
 
-    def _refresh_processes(self, command_name, open=open):
+    def _refresh_processes(self, command_name, open=open,
+                           site_check_parse=None):
         # The open argument is used for test injection.
         check_mark = global_config.global_config.get_config_value(
             'SCHEDULER', 'check_processes_for_dark_mark', bool, False)
         processes = []
         for info in self._get_process_info():
-            if info['comm'] == command_name:
+            is_parse = (site_check_parse and site_check_parse(info))
+            if info['comm'] == command_name or is_parse:
                 if (check_mark and not
                         self._check_pid_for_dark_mark(info['pid'], open=open)):
                     self._warn('%(comm)s process pid %(pid)s has no '
@@ -148,10 +150,14 @@
         * pidfiles_second_read: same info as pidfiles, but gathered after the
         processes are scanned.
         """
+        site_check_parse = utils.import_site_function(
+                __file__, 'autotest_lib.scheduler.site_drone_utility',
+                'check_parse', lambda x: False)
         results = {
             'pidfiles' : self._read_pidfiles(pidfile_paths),
             'autoserv_processes' : self._refresh_processes('autoserv'),
-            'parse_processes' : self._refresh_processes('parse'),
+            'parse_processes' : self._refresh_processes(
+                    'parse', site_check_parse=site_check_parse),
             'pidfiles_second_read' : self._read_pidfiles(pidfile_paths),
         }
         return results
--- autotest/scheduler/monitor_db.py    2010-07-23 16:15:54.000000000 -0700
+++ autotest/scheduler/monitor_db.py    2010-09-27 13:30:21.000000000 -0700
@@ -53,10 +53,16 @@
 _db = None
 _shutdown = False
 _autoserv_path = os.path.join(drones.AUTOTEST_INSTALL_DIR, 'server', 
'autoserv')
-_parser_path = os.path.join(drones.AUTOTEST_INSTALL_DIR, 'tko', 'parse')
 _testing_mode = False
 _drone_manager = None
 
+def _parser_path_default(install_dir):
+    return os.path.join(install_dir, 'tko', 'parse')
+_parser_path_func = utils.import_site_function(
+        __file__, 'autotest_lib.scheduler.site_monitor_db',
+        'parser_path', _parser_path_default)
+_parser_path = _parser_path_func(drones.AUTOTEST_INSTALL_DIR)
+
 
 def _get_pidfile_timeout_secs():
     """@returns How long to wait for autoserv to write pidfile."""
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to