Skip to content

Commit 45f896c

Browse files
committed
avoid KeyError when unregistering an engine twice
the new KernelNanny can mean that engine unregistration is requested twice avoid KeyError and skip when unregistering an engine that has already been removed
1 parent 3d832e5 commit 45f896c

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

ipyparallel/controller/hub.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -913,14 +913,17 @@ def unregister_engine(self, ident, msg):
913913
eid = msg['content']['id']
914914
except:
915915
self.log.error(
916-
"registration::bad engine id for unregistration: %r",
917-
ident,
918-
exc_info=True,
916+
f"registration::bad request for engine for unregistration: {msg['content']}",
919917
)
920918
return
921-
self.log.info("registration::unregister_engine(%r)", eid)
922-
919+
if eid not in self.engines:
920+
self.log.info(
921+
f"registration::unregister_engine({eid}) already unregistered"
922+
)
923+
return
924+
self.log.info(f"registration::unregister_engine({eid})")
923925
ec = self.engines[eid]
926+
924927
content = dict(id=eid, uuid=ec.uuid)
925928

926929
# stop the heartbeats

0 commit comments

Comments
 (0)