|
19 | 19 | from jupyter_client.session import Session
|
20 | 20 | from jupyter_client.multikernelmanager import MultiKernelManager
|
21 | 21 | from traitlets import (Any, Bool, Dict, List, Unicode, TraitError, Integer,
|
22 |
| - Instance, default, validate |
| 22 | + Float, Instance, default, validate |
23 | 23 | )
|
24 | 24 |
|
25 | 25 | from notebook.utils import to_os_path, exists
|
@@ -93,6 +93,18 @@ def _update_root_dir(self, proposal):
|
93 | 93 | no frontends are connected.
|
94 | 94 | """
|
95 | 95 | )
|
| 96 | + |
| 97 | + kernel_info_timeout = Float(60, config=True, |
| 98 | + help="""Timeout for giving up on a kernel (in seconds). |
| 99 | +
|
| 100 | + On starting and restarting kernels, we check whether the |
| 101 | + kernel is running and responsive by sending kernel_info_requests. |
| 102 | + This sets the timeout in seconds for how long the kernel can take |
| 103 | + before being presumed dead. |
| 104 | + This affects the MappingKernelManager (which handles kernel restarts) |
| 105 | + and the ZMQChannelsHandler (which handles the startup). |
| 106 | + """ |
| 107 | + ) |
96 | 108 |
|
97 | 109 | _kernel_buffers = Any()
|
98 | 110 | @default('_kernel_buffers')
|
@@ -305,7 +317,7 @@ def on_restart_failed():
|
305 | 317 | kernel.session.send(channel, "kernel_info_request")
|
306 | 318 | channel.on_recv(on_reply)
|
307 | 319 | loop = IOLoop.current()
|
308 |
| - timeout = loop.add_timeout(loop.time() + 30, on_timeout) |
| 320 | + timeout = loop.add_timeout(loop.time() + self.kernel_info_timeout, on_timeout) |
309 | 321 | return future
|
310 | 322 |
|
311 | 323 | def notify_connect(self, kernel_id):
|
@@ -434,4 +446,3 @@ def cull_kernel_if_idle(self, kernel_id):
|
434 | 446 | self.log.warning("Culling '%s' kernel '%s' (%s) with %d connections due to %s seconds of inactivity.",
|
435 | 447 | kernel.execution_state, kernel.kernel_name, kernel_id, connections, idle_duration)
|
436 | 448 | self.shutdown_kernel(kernel_id)
|
437 |
| - |
|
0 commit comments