Commit 683e5749 authored by Daniele Venzano's avatar Daniele Venzano

Catch exceptions generated while terminating containers

parent 01d3df55
......@@ -210,12 +210,15 @@ class DockerClient:
except docker.errors.NotFound:
return
cont.stop(timeout=5)
if delete:
try:
try:
if delete:
cont.remove(force=True)
except docker.errors.APIError as e:
log.warning(str(e))
else:
cont.stop(timeout=5)
except docker.errors.NotFound:
pass
except docker.errors.APIError as e:
log.warning(str(e))
def event_listener(self, callback: Callable[[str], bool]) -> None:
"""An infinite loop that listens for events from Swarm."""
......
......@@ -93,10 +93,15 @@ def main(test_conf=None):
except Exception:
log.exception('Fatal error in API loop')
finally:
log.info('Terminating scheduler thread')
scheduler.quit()
log.info('Terminating api server thread')
api_server.quit()
log.info('Terminating back-end threads')
zoe_master.backends.interface.shutdown_backend()
log.info('Terminating metric thread')
metrics.quit()
if gelf_listener is not None:
log.info('Terminating GELF listener thread')
gelf_listener.quit()
return 0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment