summaryrefslogtreecommitdiff
path: root/scheduler
diff options
context:
space:
mode:
authorlmr <lmr@592f7852-d20e-0410-864c-8624ca9c26a4>2011-02-21 21:01:57 +0000
committerlmr <lmr@592f7852-d20e-0410-864c-8624ca9c26a4>2011-02-21 21:01:57 +0000
commitdd0682d712b5bf2380b254d55f206e75bacb8670 (patch)
tree6f2e1a04c347c6f1ee5758075e57764fadd9363f /scheduler
parente353bdbd563feffd82dccddb53ccd4ce1a312a7e (diff)
Trying to shutdown the scheduler in a nicer way
Signed-off-by: Jean-Marc Eurin <jmeurin@google.com> git-svn-id: svn://test.kernel.org/autotest/trunk@5256 592f7852-d20e-0410-864c-8624ca9c26a4
Diffstat (limited to 'scheduler')
-rwxr-xr-xscheduler/monitor_db.py2
-rw-r--r--scheduler/status_server.py5
2 files changed, 6 insertions, 1 deletions
diff --git a/scheduler/monitor_db.py b/scheduler/monitor_db.py
index d506a7e4..f8ecf344 100755
--- a/scheduler/monitor_db.py
+++ b/scheduler/monitor_db.py
@@ -159,7 +159,7 @@ def main_without_exception_handling():
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:
diff --git a/scheduler/status_server.py b/scheduler/status_server.py
index 29d23db1..c5286712 100644
--- a/scheduler/status_server.py
+++ b/scheduler/status_server.py
@@ -10,6 +10,7 @@ _HEADER = """
<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 @@ class StatusServerRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
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 @@ class StatusServer(BaseHTTPServer.HTTPServer):
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)