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
This commit is contained in:
parent
2209ae6d20
commit
f1fca03fd1
|
@ -927,6 +927,12 @@ circumstances this will be the best way to stop Zuul.
|
|||
To stop the executor immediately, run ``zuul-executor stop``. Jobs that were
|
||||
running on the stopped executor will be rescheduled on other executors.
|
||||
|
||||
The executor normally responds to a ``SIGTERM`` signal in the same way
|
||||
as the ``stop`` command, however you can change this behavior to match
|
||||
``graceful`` by setting the environment variable
|
||||
``ZUUL_EXECUTOR_SIGTERM_METHOD`` to ``graceful`` (the default is
|
||||
``stop``).
|
||||
|
||||
To enable or disable running Ansible in verbose mode (with the
|
||||
``-vvv`` argument to ansible-playbook) run ``zuul-executor verbose``
|
||||
and ``zuul-executor unverbose``.
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
features:
|
||||
- |
|
||||
The executor now honors the ``ZUUL_EXECUTOR_SIGTERM_METHOD``
|
||||
environment variable to determine whether ``SIGTERM`` should be
|
||||
equivalent to the ``stop`` command (the default) or the
|
||||
``graceful`` command.
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue