Skip to content

Commit

Permalink
ignore ProcessLookupError when killing subprocesses. Closes #167
Browse files Browse the repository at this point in the history
sbourdeauducq committed Oct 28, 2015
1 parent 40b4129 commit 0d53f7a
Showing 2 changed files with 16 additions and 4 deletions.
10 changes: 8 additions & 2 deletions artiq/frontend/artiq_ctlmgr.py
Original file line number Diff line number Diff line change
@@ -134,14 +134,20 @@ async def _terminate(self):
except:
logger.warning("Controller %s did not respond to terminate "
"command, killing", self.name)
self.process.kill()
try:
self.process.kill()
except ProcessLookupError:
pass
try:
await asyncio.wait_for(self.process.wait(),
self.term_timeout)
except:
logger.warning("Controller %s failed to exit, killing",
self.name)
self.process.kill()
try:
self.process.kill()
except ProcessLookupError:
pass
await self.process.wait()
logger.debug("Controller %s terminated", self.name)

10 changes: 8 additions & 2 deletions artiq/master/worker.py
Original file line number Diff line number Diff line change
@@ -94,14 +94,20 @@ async def close(self, term_timeout=1.0):
except:
logger.warning("failed to send terminate command to worker"
" (RID %s), killing", self.rid, exc_info=True)
self.process.kill()
try:
self.process.kill()
except ProcessLookupError:
pass
await self.process.wait()
return
try:
await asyncio.wait_for(self.process.wait(), term_timeout)
except asyncio.TimeoutError:
logger.warning("worker did not exit (RID %s), killing", self.rid)
self.process.kill()
try:
self.process.kill()
except ProcessLookupError:
pass
await self.process.wait()
else:
logger.debug("worker exited gracefully (RID %s)", self.rid)

0 comments on commit 0d53f7a

Please sign in to comment.