Skip to content

Commit

Permalink
Try to ensure the spalloc keepalive process dies
Browse files Browse the repository at this point in the history
  • Loading branch information
rowleya committed Jan 25, 2023
1 parent e41c32e commit fc0f76e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions spinnman/spalloc/spalloc_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,16 +500,22 @@ def launch_keepalive_task(self, period=30):
class Closer(AbstractContextManager):
def __init__(self):
self._queue = Queue(1)
self._p = None

def close(self):
self._queue.put("quit")
# Give it a second, and if it still isn't dead, kill it
p.join(1)
if p.is_alive():
p.kill()

self._keepalive_handle = Closer()
# pylint: disable=protected-access
p = Process(target=_SpallocKeepalive, args=(
self._keepalive_url, period, self._keepalive_handle._queue,
*self._session_credentials), daemon=True)
p.start()
self._keepalive_handle._p = p
return self._keepalive_handle

@overrides(SpallocJob.where_is_machine)
Expand Down

0 comments on commit fc0f76e

Please sign in to comment.