Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc6dd032

Browse files
committed
add kernel_info_timeout traitlet to wait for slow kernel startups
This affects both the MappingKernelManager and the ZMQChannelsHandler(by extension). This allows one setting to apply to both startup andrestarting.
1 parent459b92c commitc6dd032

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

‎notebook/services/kernels/handlers.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ class ZMQChannelsHandler(AuthenticatedZMQStreamHandler):
104104

105105
@property
106106
defkernel_info_timeout(self):
107-
returnself.settings.get('kernel_info_timeout',10)
107+
km_default=self.kernel_manager.kernel_info_timeout
108+
returnself.settings.get('kernel_info_timeout',km_default)
108109

109110
@property
110111
defiopub_msg_rate_limit(self):

‎notebook/services/kernels/kernelmanager.py‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
fromjupyter_client.sessionimportSession
2020
fromjupyter_client.multikernelmanagerimportMultiKernelManager
2121
fromtraitletsimport (Any,Bool,Dict,List,Unicode,TraitError,Integer,
22-
Instance,default,validate
22+
Float,Instance,default,validate
2323
)
2424

2525
fromnotebook.utilsimportto_os_path,exists
@@ -93,6 +93,18 @@ def _update_root_dir(self, proposal):
9393
no frontends are connected.
9494
"""
9595
)
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+
)
96108

97109
_kernel_buffers=Any()
98110
@default('_kernel_buffers')
@@ -305,7 +317,7 @@ def on_restart_failed():
305317
kernel.session.send(channel,"kernel_info_request")
306318
channel.on_recv(on_reply)
307319
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)
309321
returnfuture
310322

311323
defnotify_connect(self,kernel_id):
@@ -434,4 +446,3 @@ def cull_kernel_if_idle(self, kernel_id):
434446
self.log.warning("Culling '%s' kernel '%s' (%s) with %d connections due to %s seconds of inactivity.",
435447
kernel.execution_state,kernel.kernel_name,kernel_id,connections,idle_duration)
436448
self.shutdown_kernel(kernel_id)
437-

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp