File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ class KernelRestarter(LoggingConfigurable):
36
36
)
37
37
_restarting = Bool (False )
38
38
_restart_count = Integer (0 )
39
+ _initial_startup = Bool (True )
39
40
40
41
callbacks = Dict ()
41
42
def _callbacks_default (self ):
@@ -98,14 +99,17 @@ def poll(self):
98
99
self ._restart_count = 0
99
100
self .stop ()
100
101
else :
101
- self .log .info ('KernelRestarter: restarting kernel (%i/%i)' ,
102
+ self .log .info ('KernelRestarter: restarting kernel (%i/%i), %s random ports ' ,
102
103
self ._restart_count ,
103
- self .restart_limit
104
+ self .restart_limit ,
105
+ 'new' if self ._initial_startup else 'keep'
104
106
)
105
107
self ._fire_callbacks ('restart' )
106
- self .kernel_manager .restart_kernel (now = True )
108
+ self .kernel_manager .restart_kernel (now = True , newports = self . _initial_startup )
107
109
self ._restarting = True
108
110
else :
111
+ if self ._initial_startup :
112
+ self ._initial_startup = False
109
113
if self ._restarting :
110
114
self .log .debug ("KernelRestarter: restart apparently succeeded" )
111
115
self ._restarting = False
You can’t perform that action at this time.
0 commit comments