Show More
@@ -259,15 +259,15 b' class KernelManager(LoggingConfigurable, ConnectionFileMixin):' | |||||
259 | msg = self.session.msg("shutdown_request", content=content) |
|
259 | msg = self.session.msg("shutdown_request", content=content) | |
260 | self.session.send(self._control_socket, msg) |
|
260 | self.session.send(self._control_socket, msg) | |
261 |
|
261 | |||
262 |
def |
|
262 | def finish_shutdown(self, waittime=1, pollinterval=0.1): | |
263 | """Wait for kernel shutdown, then kill process if it doesn't shutdown. |
|
263 | """Wait for kernel shutdown, then kill process if it doesn't shutdown. | |
264 |
|
264 | |||
265 | This does not send shutdown requests - use :meth:`request_shutdown` |
|
265 | This does not send shutdown requests - use :meth:`request_shutdown` | |
266 | first. |
|
266 | first. | |
267 | """ |
|
267 | """ | |
268 |
for i in range(int(t |
|
268 | for i in range(int(waittime/pollinterval)): | |
269 | if self.is_alive(): |
|
269 | if self.is_alive(): | |
270 | time.sleep(interval) |
|
270 | time.sleep(pollinterval) | |
271 | else: |
|
271 | else: | |
272 | break |
|
272 | break | |
273 | else: |
|
273 | else: | |
@@ -311,7 +311,7 b' class KernelManager(LoggingConfigurable, ConnectionFileMixin):' | |||||
311 | # Don't send any additional kernel kill messages immediately, to give |
|
311 | # Don't send any additional kernel kill messages immediately, to give | |
312 | # the kernel a chance to properly execute shutdown actions. Wait for at |
|
312 | # the kernel a chance to properly execute shutdown actions. Wait for at | |
313 | # most 1s, checking every 0.1s. |
|
313 | # most 1s, checking every 0.1s. | |
314 |
self. |
|
314 | self.finish_shutdown() | |
315 |
|
315 | |||
316 | self.cleanup(connection_file=not restart) |
|
316 | self.cleanup(connection_file=not restart) | |
317 |
|
317 |
@@ -138,7 +138,7 b' class MultiKernelManager(LoggingConfigurable):' | |||||
138 | """Ask a kernel to shut down by its kernel uuid""" |
|
138 | """Ask a kernel to shut down by its kernel uuid""" | |
139 |
|
139 | |||
140 | @kernel_method |
|
140 | @kernel_method | |
141 |
def |
|
141 | def finish_shutdown(self, kernel_id, waittime=1, pollinterval=0.1): | |
142 | """Wait for a kernel to finish shutting down, and kill it if it doesn't |
|
142 | """Wait for a kernel to finish shutting down, and kill it if it doesn't | |
143 | """ |
|
143 | """ | |
144 | self.log.info("Kernel shutdown: %s" % kernel_id) |
|
144 | self.log.info("Kernel shutdown: %s" % kernel_id) | |
@@ -163,7 +163,7 b' class MultiKernelManager(LoggingConfigurable):' | |||||
163 | for kid in kids: |
|
163 | for kid in kids: | |
164 | self.request_shutdown(kid) |
|
164 | self.request_shutdown(kid) | |
165 | for kid in kids: |
|
165 | for kid in kids: | |
166 |
self. |
|
166 | self.finish_shutdown(kid) | |
167 | self.cleanup(kid) |
|
167 | self.cleanup(kid) | |
168 |
|
168 | |||
169 | @kernel_method |
|
169 | @kernel_method |
General Comments 0
You need to be logged in to leave comments.
Login now