|
19 | 19 | fromjupyter_client.sessionimportSession |
20 | 20 | fromjupyter_client.multikernelmanagerimportMultiKernelManager |
21 | 21 | fromtraitletsimport (Any,Bool,Dict,List,Unicode,TraitError,Integer, |
22 | | -Instance,default,validate |
| 22 | +Float,Instance,default,validate |
23 | 23 | ) |
24 | 24 |
|
25 | 25 | fromnotebook.utilsimportto_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 | returnfuture |
310 | 322 |
|
311 | 323 | defnotify_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 | | - |
|