summaryrefslogtreecommitdiff
path: root/zuul/cmd
diff options
context:
space:
mode:
authorJames E. Blair <jim@acmegating.com>2021-07-06 10:42:31 -0700
committerJames E. Blair <jim@acmegating.com>2021-07-09 08:02:15 -0700
commitf1fca03fd1688887161543cd709fbcf84d58431c (patch)
treef01b443bc6695d6107a33f1a73dd89fa9c775692 /zuul/cmd
parent2209ae6d205393400553247a6f9b0867f3140e89 (diff)
downloadzuul-f1fca03fd1688887161543cd709fbcf84d58431c.tar.gz
Add graceful stop environment variable
Add an environment variable that lets users (especially container image users) easily select which way they would like zuul-executor to handle SIGTERM. Change-Id: I8d42ea1c19f3e627bbfd32a535493de0cb8a04be
Diffstat (limited to 'zuul/cmd')
-rwxr-xr-xzuul/cmd/executor.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/zuul/cmd/executor.py b/zuul/cmd/executor.py
index 15ff0272b..500b41516 100755
--- a/zuul/cmd/executor.py
+++ b/zuul/cmd/executor.py
@@ -44,7 +44,11 @@ class Executor(zuul.cmd.ZuulDaemonApp):
self.args.nodaemon = True
def exit_handler(self, signum, frame):
- self.executor.stop()
+ graceful = os.environ.get('ZUUL_EXECUTOR_SIGTERM_METHOD', 'stop')
+ if graceful.lower() == 'graceful':
+ self.executor.graceful()
+ else:
+ self.executor.stop()
def start_log_streamer(self):
pipe_read, pipe_write = os.pipe()