forked from M-Labs/artiq
1
0
Fork 0

ctlmgr: catch create_subprocess_exec errors and retry

This commit is contained in:
Sebastien Bourdeauducq 2015-02-08 12:15:22 +08:00
parent 96a01efc48
commit abb7d9f911
1 changed files with 7 additions and 3 deletions

View File

@ -47,9 +47,13 @@ class Controller:
while True: while True:
logger.info("Starting controller %s with command: %s", logger.info("Starting controller %s with command: %s",
name, command) name, command)
process = yield from asyncio.create_subprocess_exec(*command.split()) try:
yield from asyncio.shield(process.wait()) process = yield from asyncio.create_subprocess_exec(*command.split())
logger.warning("Controller %s exited", name) yield from asyncio.shield(process.wait())
except FileNotFoundError:
logger.warning("Controller %s failed to start", name)
else:
logger.warning("Controller %s exited", name)
logger.warning("Restarting in %.1f seconds", retry) logger.warning("Restarting in %.1f seconds", retry)
yield from asyncio.sleep(retry) yield from asyncio.sleep(retry)
except asyncio.CancelledError: except asyncio.CancelledError: