summaryrefslogtreecommitdiff
path: root/zuul/cmd/executor.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/executor.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/executor.py')
-rwxr-xr-xzuul/cmd/executor.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/zuul/cmd/executor.py b/zuul/cmd/executor.py
index 5b06f0cca..b050a5979 100755
--- a/zuul/cmd/executor.py
+++ b/zuul/cmd/executor.py
@@ -17,6 +17,7 @@
import logging
import os
import sys
+import signal
import tempfile
import zuul.cmd
@@ -50,6 +51,8 @@ class Executor(zuul.cmd.ZuulDaemonApp):
def exit_handler(self, signum, frame):
self.executor.stop()
+ self.executor.join()
+ sys.exit(0)
def start_log_streamer(self):
pipe_read, pipe_write = os.pipe()
@@ -106,7 +109,16 @@ class Executor(zuul.cmd.ZuulDaemonApp):
log_streaming_port=self.finger_port)
self.executor.start()
- self.executor.join()
+ if self.args.nodaemon:
+ signal.signal(signal.SIGTERM, self.exit_handler)
+ while True:
+ try:
+ signal.pause()
+ except KeyboardInterrupt:
+ print("Ctrl + C: asking executor to exit nicely...\n")
+ self.exit_handler(signal.SIGINT, None)
+ else:
+ self.executor.join()
def main():