Show More
@@ -137,6 +137,16 b' class MultiKernelManager(LoggingConfigurable):' | |||
|
137 | 137 | """ |
|
138 | 138 | return self.get_kernel(kernel_id).signal_kernel(signum) |
|
139 | 139 | |
|
140 | def restart_kernel(self, kernel_id): | |
|
141 | """Restart a kernel by its uuid, keeping the same ports. | |
|
142 | ||
|
143 | Parameters | |
|
144 | ========== | |
|
145 | kernel_id : uuid | |
|
146 | The id of the kernel to interrupt. | |
|
147 | """ | |
|
148 | return self.get_kernel(kernel_id).restart_kernel() | |
|
149 | ||
|
140 | 150 | def get_kernel(self, kernel_id): |
|
141 | 151 | """Get the single KernelManager object for a kernel by its uuid. |
|
142 | 152 | |
@@ -302,24 +312,9 b' class MappingKernelManager(MultiKernelManager):' | |||
|
302 | 312 | def restart_kernel(self, kernel_id): |
|
303 | 313 | """Restart a kernel while keeping clients connected.""" |
|
304 | 314 | self._check_kernel_id(kernel_id) |
|
305 |
|
|
|
306 | km.restart_kernel() | |
|
315 | super(MappingKernelManager, self).restart_kernel(kernel_id) | |
|
307 | 316 | self.log.info("Kernel restarted: %s" % kernel_id) |
|
308 | 317 | return kernel_id |
|
309 | ||
|
310 | # the following remains, in case the KM restart machinery is | |
|
311 | # somehow unacceptable | |
|
312 | # Get the notebook_id to preserve the kernel/notebook association. | |
|
313 | notebook_id = self.notebook_for_kernel(kernel_id) | |
|
314 | # Create the new kernel first so we can move the clients over. | |
|
315 | new_kernel_id = self.start_kernel() | |
|
316 | # Now kill the old kernel. | |
|
317 | self.kill_kernel(kernel_id) | |
|
318 | # Now save the new kernel/notebook association. We have to save it | |
|
319 | # after the old kernel is killed as that will delete the mapping. | |
|
320 | self.set_kernel_for_notebook(notebook_id, new_kernel_id) | |
|
321 | self.log.info("Kernel restarted: %s" % new_kernel_id) | |
|
322 | return new_kernel_id | |
|
323 | 318 | |
|
324 | 319 | def create_iopub_stream(self, kernel_id): |
|
325 | 320 | """Create a new iopub stream.""" |
General Comments 0
You need to be logged in to leave comments.
Login now