##// END OF EJS Templates
Rename 'instant_death' to 'now' as per code review.
Fernando Perez -
Show More
@@ -228,7 +228,7 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):'
228 228
229 229 elif key == QtCore.Qt.Key_Period:
230 230 message = 'Are you sure you want to restart the kernel?'
231 self.restart_kernel(message, instant_death=False)
231 self.restart_kernel(message, now=False)
232 232 return True
233 233
234 234 elif not event.modifiers() & QtCore.Qt.AltModifier:
@@ -322,7 +322,7 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):'
322 322 if self.custom_restart:
323 323 self.custom_restart_kernel_died.emit(since_last_heartbeat)
324 324 else:
325 self.restart_kernel(message, instant_death=True)
325 self.restart_kernel(message, now=True)
326 326
327 327 def _handle_object_info_reply(self, rep):
328 328 """ Handle replies for call tips.
@@ -395,10 +395,10 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):'
395 395 self._append_plain_text('Kernel process is either remote or '
396 396 'unspecified. Cannot interrupt.\n')
397 397
398 def restart_kernel(self, message, instant_death=False):
398 def restart_kernel(self, message, now=False):
399 399 """ Attempts to restart the running kernel.
400 400 """
401 # FIXME: instant_death should be configurable via a checkbox in the
401 # FIXME: now should be configurable via a checkbox in the
402 402 # dialog. Right now at least the heartbeat path sets it to True and
403 403 # the manual restart to False. But those should just be the
404 404 # pre-selected states of a checkbox that the user could override if so
@@ -421,8 +421,7 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):'
421 421 message, buttons)
422 422 if result == QtGui.QMessageBox.Yes:
423 423 try:
424 self.kernel_manager.restart_kernel(
425 instant_death=instant_death)
424 self.kernel_manager.restart_kernel(now=now)
426 425 except RuntimeError:
427 426 message = 'Kernel started externally. Cannot restart.\n'
428 427 self._append_plain_text(message)
@@ -757,14 +757,14 b' class KernelManager(HasTraits):'
757 757 if self.has_kernel:
758 758 self.kill_kernel()
759 759
760 def restart_kernel(self, instant_death=False):
760 def restart_kernel(self, now=False):
761 761 """Restarts a kernel with the same arguments that were used to launch
762 762 it. If the old kernel was launched with random ports, the same ports
763 763 will be used for the new kernel.
764 764
765 765 Parameters
766 766 ----------
767 instant_death : bool, optional
767 now : bool, optional
768 768 If True, the kernel is forcefully restarted *immediately*, without
769 769 having a chance to do any cleanup action. Otherwise the kernel is
770 770 given 1s to clean up before a forceful restart is issued.
@@ -777,7 +777,7 b' class KernelManager(HasTraits):'
777 777 "No previous call to 'start_kernel'.")
778 778 else:
779 779 if self.has_kernel:
780 if instant_death:
780 if now:
781 781 self.kill_kernel()
782 782 else:
783 783 self.shutdown_kernel()
General Comments 0
You need to be logged in to leave comments. Login now