aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kolla/image/build.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/kolla/image/build.py b/kolla/image/build.py
index eee5b036b..d0d36a457 100644
--- a/kolla/image/build.py
+++ b/kolla/image/build.py
@@ -117,9 +117,21 @@ STATUS_ERRORS = (STATUS_CONNECTION_ERROR, STATUS_PUSH_ERROR,
def join_many(threads):
try:
yield
- finally:
for t in threads:
t.join()
+ except KeyboardInterrupt:
+ try:
+ LOG.info('Waiting for daemon threads exit. Push Ctrl + c again to'
+ ' force exit')
+ for t in threads:
+ if t.is_alive():
+ LOG.debug('Waiting thread %s to exit', t.name)
+ # NOTE(Jeffrey4l): Python Bug: When join without timeout,
+ # KeyboardInterrupt is never sent.
+ t.join(0xffff)
+ LOG.debug('Thread %s exits', t.name)
+ except KeyboardInterrupt:
+ LOG.warning('Force exits')
class DockerTask(task.Task):
@@ -974,6 +986,7 @@ def run_build():
for x in six.moves.range(conf.push_threads):
worker = WorkerThread(conf, push_queue)
+ worker.setDaemon(True)
worker.start()
workers.append(worker)