Show More
@@ -33,7 +33,7 b' except:' | |||||
33 | from IPython.core import page |
|
33 | from IPython.core import page | |
34 | from IPython.utils.warn import warn, error |
|
34 | from IPython.utils.warn import warn, error | |
35 | from IPython.utils import io |
|
35 | from IPython.utils import io | |
36 | from IPython.utils.traitlets import List, Enum, Any, Instance, Unicode |
|
36 | from IPython.utils.traitlets import List, Enum, Any, Instance, Unicode, Float | |
37 | from IPython.utils.tempdir import NamedFileInTemporaryDirectory |
|
37 | from IPython.utils.tempdir import NamedFileInTemporaryDirectory | |
38 |
|
38 | |||
39 | from IPython.terminal.interactiveshell import TerminalInteractiveShell |
|
39 | from IPython.terminal.interactiveshell import TerminalInteractiveShell | |
@@ -44,6 +44,15 b' class ZMQTerminalInteractiveShell(TerminalInteractiveShell):' | |||||
44 | """A subclass of TerminalInteractiveShell that uses the 0MQ kernel""" |
|
44 | """A subclass of TerminalInteractiveShell that uses the 0MQ kernel""" | |
45 | _executing = False |
|
45 | _executing = False | |
46 | _execution_state = Unicode('') |
|
46 | _execution_state = Unicode('') | |
|
47 | kernel_timeout = Float(60, config=True, | |||
|
48 | help="""Timeout for giving up on a kernel (in seconds). | |||
|
49 | ||||
|
50 | On first connect and restart, the console tests whether the | |||
|
51 | kernel is running and responsive by sending kernel_info_requests. | |||
|
52 | This sets the timeout in seconds for how long the kernel can take | |||
|
53 | before being presumed dead. | |||
|
54 | """ | |||
|
55 | ) | |||
47 |
|
56 | |||
48 | image_handler = Enum(('PIL', 'stream', 'tempfile', 'callable'), |
|
57 | image_handler = Enum(('PIL', 'stream', 'tempfile', 'callable'), | |
49 | config=True, help= |
|
58 | config=True, help= | |
@@ -393,7 +402,7 b' class ZMQTerminalInteractiveShell(TerminalInteractiveShell):' | |||||
393 | # run a non-empty no-op, so that we don't get a prompt until |
|
402 | # run a non-empty no-op, so that we don't get a prompt until | |
394 | # we know the kernel is ready. This keeps the connection |
|
403 | # we know the kernel is ready. This keeps the connection | |
395 | # message above the first prompt. |
|
404 | # message above the first prompt. | |
396 |
if not self.wait_for_kernel( |
|
405 | if not self.wait_for_kernel(self.kernel_timeout): | |
397 | error("Kernel did not respond\n") |
|
406 | error("Kernel did not respond\n") | |
398 | return |
|
407 | return | |
399 |
|
408 | |||
@@ -414,7 +423,7 b' class ZMQTerminalInteractiveShell(TerminalInteractiveShell):' | |||||
414 | if ans: |
|
423 | if ans: | |
415 | if self.manager: |
|
424 | if self.manager: | |
416 | self.manager.restart_kernel(True) |
|
425 | self.manager.restart_kernel(True) | |
417 |
self.wait_for_kernel( |
|
426 | self.wait_for_kernel(self.kernel_timeout) | |
418 | else: |
|
427 | else: | |
419 | self.exit_now = True |
|
428 | self.exit_now = True | |
420 | continue |
|
429 | continue |
General Comments 0
You need to be logged in to leave comments.
Login now