Fix termination steps

Another, hopefully better attempt: Ignore the TERM signal in the sending
process so that we can properly clean up all the futures before actually
closing. This also avoids a "Terminated" message even on regular kas
endings.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
Jan Kiszka 2017-06-28 19:26:01 +02:00 committed by Daniel Wagner
parent adb4007482
commit 7248d5e1bb

View File

@ -92,9 +92,14 @@ def _atexit_handler():
"""
Close event loop and terminate the whole process group
"""
asyncio.get_event_loop().close()
signal.signal(signal.SIGTERM, signal.SIG_IGN)
os.killpg(os.getpid(), signal.SIGTERM)
loop = asyncio.get_event_loop()
pending = asyncio.Task.all_tasks()
loop.run_until_complete(asyncio.gather(*pending))
loop.close()
def kas_get_argparser():
"""