mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-13 11:49:11 -07:00
Add a function to check for killed processes in all strategies (#16684)
* Add a function to check for killed processes so that if any threads are sigkilled or sigtermed, the entire playbook execution is aborted.
This commit is contained in:
parent
ae0c1bbc47
commit
238c6461f6
3 changed files with 22 additions and 1 deletions
|
@ -316,6 +316,18 @@ class TaskQueueManager:
|
|||
def terminate(self):
|
||||
self._terminated = True
|
||||
|
||||
def has_dead_workers(self):
|
||||
|
||||
# [<WorkerProcess(WorkerProcess-2, stopped[SIGKILL])>,
|
||||
# <WorkerProcess(WorkerProcess-2, stopped[SIGTERM])>
|
||||
|
||||
defunct = False
|
||||
for idx,x in enumerate(self._workers):
|
||||
if hasattr(x[0], 'exitcode'):
|
||||
if x[0].exitcode in [-9, -15]:
|
||||
defunct = True
|
||||
return defunct
|
||||
|
||||
def send_callback(self, method_name, *args, **kwargs):
|
||||
for callback_plugin in [self._stdout_callback] + self._callback_plugins:
|
||||
# a plugin that set self.disabled to True will not be called
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue