Don't wait for forever to join streamer
We want to clean up after ourselves, but we don't just want to lock for
forever. If we can't do a clean join, log to the job log and the
executor debug log and move on.
Change-Id: Ia12f953948aa8fd6c5b7035944e597ab85e73947
diff --git a/zuul/ansible/callback/zuul_stream.py b/zuul/ansible/callback/zuul_stream.py
index 2068925..4424bb9 100644
--- a/zuul/ansible/callback/zuul_stream.py
+++ b/zuul/ansible/callback/zuul_stream.py
@@ -166,9 +166,16 @@
self._streamer.daemon = True
self._streamer.start()
- def v2_runner_on_failed(self, result, ignore_errors=False):
+ def _stop_streamer(self):
if self._streamer:
- self._streamer.join()
+ self._streamer.join(30)
+ if self._streamer.is_alive():
+ msg = "{now} | [Zuul] Log Stream did not terminate".format(
+ now=datetime.datetime.now())
+ self._log.info(msg)
+
+ def v2_runner_on_failed(self, result, ignore_errors=False):
+ self._stop_streamer()
if result._task.action in ('command', 'shell'):
zuul_filter_result(result._result)
self._handle_exception(result._result)
@@ -194,8 +201,7 @@
if result._task.action in ('include', 'include_role'):
return
- if self._streamer:
- self._streamer.join()
+ self._stop_streamer()
if result._result.get('changed', False):
status = 'changed'