From 2b6ef68e60f4209a10efd7dd92a371781cbf36f0 Mon Sep 17 00:00:00 2001 From: Chris Sewell Date: Thu, 4 Mar 2021 21:39:40 +0100 Subject: [PATCH] remove process from cache after step_until_terminated --- plumpy/process_comms.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plumpy/process_comms.py b/plumpy/process_comms.py index 57e02755..ecc75b95 100644 --- a/plumpy/process_comms.py +++ b/plumpy/process_comms.py @@ -602,7 +602,10 @@ async def _launch( asyncio.ensure_future(proc.step_until_terminated()) return proc.pid - await proc.step_until_terminated() + try: + await proc.step_until_terminated() + finally: + self._process_cache.pop(proc.pid, None) return proc.future().result() @@ -638,7 +641,10 @@ async def _continue( asyncio.ensure_future(proc.step_until_terminated()) return proc.pid - await proc.step_until_terminated() + try: + await proc.step_until_terminated() + finally: + self._process_cache.pop(proc.pid, None) return proc.future().result()