Skip to content

Commit 382e943

Browse files
authored
Merge pull request #466 from minrk/shutdown-uuid
Fix engine id lookup in shutdown notification
2 parents 27c767e + e245e1a commit 382e943

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

ipyparallel/controller/hub.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -277,14 +277,14 @@ def _engine_ip_default(self):
277277
'DictDB',
278278
config=True,
279279
help="""The class to use for the DB backend
280-
280+
281281
Options include:
282-
282+
283283
SQLiteDB: SQLite
284284
MongoDB : use MongoDB
285285
DictDB : in-memory storage (fastest, but be mindful of memory growth of the Hub)
286286
NoDB : disable database altogether (default)
287-
287+
288288
""",
289289
)
290290

@@ -1100,7 +1100,11 @@ def monitor_iopub_message(self, topics, msg):
11001100
msg_type = msg['header']['msg_type']
11011101
if msg_type == 'shutdown_reply':
11021102
session = msg['header']['session']
1103-
eid = self.by_ident.get(session, None)
1103+
uuid_bytes = session.encode("utf8", "replace")
1104+
eid = self.by_ident.get(uuid_bytes, None)
1105+
if eid is None:
1106+
self.log.error(f"Found no engine for {session}")
1107+
return
11041108
uuid = self.engines[eid].uuid
11051109
self.unregister_engine(
11061110
ident='shutdown_reply', msg=dict(content=dict(id=eid, queue=uuid))

0 commit comments

Comments
 (0)