Skip to content

Commit a315d77

Browse files
kevin-batesZsailer
authored andcommitted
Skip kernel_info_reply responses when validating seeding
1 parent 1792a7a commit a315d77

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

kernel_gateway/services/kernels/manager.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,16 @@ async def start_kernel(self, *args, **kwargs):
101101
# executed
102102
if self.parent.personality.should_seed_cell(code):
103103
client.execute(code)
104-
msg = await client.get_shell_msg()
105-
if msg['content']['status'] != 'ok':
106-
# Shutdown the channels to remove any lingering ZMQ messages
107-
client.stop_channels()
108-
# Shutdown the kernel
109-
await self.shutdown_kernel(kernel_id)
110-
raise RuntimeError('Error seeding kernel memory', msg['content'])
104+
msg_type = "kernel_info_reply"
105+
while msg_type == "kernel_info_reply":
106+
msg = await client.get_shell_msg()
107+
msg_type = msg['msg_type']
108+
if msg['content']['status'] != 'ok':
109+
# Shutdown the channels to remove any lingering ZMQ messages
110+
client.stop_channels()
111+
# Shutdown the kernel
112+
await self.shutdown_kernel(kernel_id)
113+
raise RuntimeError('Error seeding kernel memory', msg['content'])
111114
# Shutdown the channels to remove any lingering ZMQ messages
112115
client.stop_channels()
113116
return kernel_id

0 commit comments

Comments
 (0)