Trying to shutdown the scheduler in a nicer way.

Signed-off-by: Jean-Marc Eurin <[email protected]>

--- autotest/scheduler/monitor_db.py    2010-09-30 14:37:09.000000000 -0700
+++ autotest/scheduler/monitor_db.py    2011-01-28 16:22:52.000000000 -0800
@@ -159,7 +159,7 @@
         dispatcher = Dispatcher()
         dispatcher.initialize(recover_hosts=options.recover_hosts)
 
-        while not _shutdown:
+        while not _shutdown and not server._shutdown_scheduler:
             dispatcher.tick()
             time.sleep(scheduler_config.config.tick_pause_sec)
     except:
--- autotest/scheduler/status_server.py 2010-02-05 17:29:36.000000000 -0800
+++ autotest/scheduler/status_server.py 2011-01-28 16:22:52.000000000 -0800
@@ -10,6 +10,7 @@
 <body>
 Actions:<br>
 <a href="?reparse_config=1">Reparse global config values</a><br>
+<a href="?restart_scheduler=1">Restart the scheduler</a><br>
 <br>
 """
 
@@ -74,6 +75,9 @@
             scheduler_config.config.read_config()
             self.server._drone_manager.refresh_drone_configs()
             self._write_line('Reparsed config!')
+        elif 'restart_scheduler' in arguments:
+            self.server._shutdown_scheduler = True
+            self._write_line('Posted the shutdown request')
         self._write_line()
 
 
@@ -97,6 +101,7 @@
                                            StatusServerRequestHandler)
         self._shutting_down = False
         self._drone_manager = drone_manager.instance()
+        self._shutdown_scheduler = False
 
         # ensure the listening socket is not inherited by child processes
         old_flags = fcntl.fcntl(self.fileno(), fcntl.F_GETFD)
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to