Show More
@@ -356,13 +356,20 b' class ZMQTerminalInteractiveShell(TerminalInteractiveShell):' | |||||
356 | tic = time.time() |
|
356 | tic = time.time() | |
357 | self.client.hb_channel.unpause() |
|
357 | self.client.hb_channel.unpause() | |
358 | while True: |
|
358 | while True: | |
359 | self.run_cell('1', False) |
|
359 | msg_id = self.client.kernel_info() | |
360 | if self.client.hb_channel.is_beating(): |
|
360 | reply = None | |
361 | # heart failure was not the reason this returned |
|
361 | while True: | |
|
362 | try: | |||
|
363 | reply = self.client.get_shell_msg(timeout=1) | |||
|
364 | except Empty: | |||
362 | break |
|
365 | break | |
363 | else: |
|
366 | else: | |
|
367 | if reply['parent_header'].get('msg_id') == msg_id: | |||
|
368 | return True | |||
|
369 | if timeout is not None \ | |||
|
370 | and (time.time() - tic) > timeout \ | |||
|
371 | and not self.client.hb_channel.is_beating(): | |||
364 | # heart failed |
|
372 | # heart failed | |
365 | if timeout is not None and (time.time() - tic) > timeout: |
|
|||
366 |
|
|
373 | return False | |
367 | return True |
|
374 | return True | |
368 |
|
375 | |||
@@ -386,7 +393,7 b' class ZMQTerminalInteractiveShell(TerminalInteractiveShell):' | |||||
386 | # run a non-empty no-op, so that we don't get a prompt until |
|
393 | # run a non-empty no-op, so that we don't get a prompt until | |
387 | # we know the kernel is ready. This keeps the connection |
|
394 | # we know the kernel is ready. This keeps the connection | |
388 | # message above the first prompt. |
|
395 | # message above the first prompt. | |
389 |
if not self.wait_for_kernel( |
|
396 | if not self.wait_for_kernel(60): | |
390 | error("Kernel did not respond\n") |
|
397 | error("Kernel did not respond\n") | |
391 | return |
|
398 | return | |
392 |
|
399 | |||
@@ -407,7 +414,7 b' class ZMQTerminalInteractiveShell(TerminalInteractiveShell):' | |||||
407 | if ans: |
|
414 | if ans: | |
408 | if self.manager: |
|
415 | if self.manager: | |
409 | self.manager.restart_kernel(True) |
|
416 | self.manager.restart_kernel(True) | |
410 |
self.wait_for_kernel( |
|
417 | self.wait_for_kernel(30) | |
411 | else: |
|
418 | else: | |
412 | self.exit_now = True |
|
419 | self.exit_now = True | |
413 | continue |
|
420 | continue |
General Comments 0
You need to be logged in to leave comments.
Login now