summaryrefslogtreecommitdiff
path: root/zuul/cmd/scheduler.py
diff options
context:
space:
mode:
authorTobias Henkel <tobias.henkel@bmw.de>2018-01-22 15:15:19 +0100
committerTobias Henkel <tobias.henkel@bmw.de>2018-01-22 15:20:24 +0100
commitb3cab1d779aa5c95eef09cc56da124b806d781c8 (patch)
tree93a72c924658865f1942e2efc6440c7ad5ad12ab /zuul/cmd/scheduler.py
parent495a52d2aeec647b036c406e74370b78d83cbf8c (diff)
downloadzuul-b3cab1d779aa5c95eef09cc56da124b806d781c8.tar.gz
Revert "Register term_handler for all zuul apps"
This reverts commit 00d7ea51fd1633a141b2e97291baa425be1680c8. It intended to refactor common code paths for signal handling. However in our dockerized deployment this seems to completely break signal handling. Thus it needs to be reverted. Change-Id: Id5731557ff9a363c7a3d9438a8efcd476e38380c
Diffstat (limited to 'zuul/cmd/scheduler.py')
-rwxr-xr-xzuul/cmd/scheduler.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/zuul/cmd/scheduler.py b/zuul/cmd/scheduler.py
index 3cffa1010..7748a80a7 100755
--- a/zuul/cmd/scheduler.py
+++ b/zuul/cmd/scheduler.py
@@ -63,7 +63,9 @@ class Scheduler(zuul.cmd.ZuulDaemonApp):
def exit_handler(self, signum, frame):
self.sched.exit()
+ self.sched.join()
self.stop_gear_server()
+ sys.exit(0)
def start_gear_server(self):
pipe_read, pipe_write = os.pipe()
@@ -173,7 +175,16 @@ class Scheduler(zuul.cmd.ZuulDaemonApp):
signal.signal(signal.SIGHUP, self.reconfigure_handler)
- self.sched.join()
+ if self.args.nodaemon:
+ signal.signal(signal.SIGTERM, self.exit_handler)
+ while True:
+ try:
+ signal.pause()
+ except KeyboardInterrupt:
+ print("Ctrl + C: asking scheduler to exit nicely...\n")
+ self.exit_handler(signal.SIGINT, None)
+ else:
+ self.sched.join()
def main():