From 43f867c29547aa6b494188b6ff5176c37c9ef502 Mon Sep 17 00:00:00 2001 From: Marc Udoff Date: Thu, 31 Aug 2023 20:00:48 -0400 Subject: [PATCH 1/3] Clarify what a restart means --- docs/messaging.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/messaging.rst b/docs/messaging.rst index 28ebec91..d7cde86a 100644 --- a/docs/messaging.rst +++ b/docs/messaging.rst @@ -1049,6 +1049,13 @@ multiple cases: IPythonQt client) to force a kernel restart to get a clean kernel without losing client-side state like history or inlined figures. +A restart should only restart the kernel and its subprocesses and not any +parent processes. That is, a restart should be "in-place". For local kernels, +there is typically no parent process so a "hard" restart and an in-place +restart are identical whereas for remote kernels this is not generally the same. + +.. versionchanged:: 5.4 + The client sends a shutdown request to the kernel, and once it receives the reply message (which is otherwise empty), it can assume that the kernel has completed shutdown safely. The request is sent on the `control` channel. From 3e7e4a491c102db3be031258bc749ba136a7a873 Mon Sep 17 00:00:00 2001 From: Marc Udoff Date: Fri, 1 Sep 2023 10:25:40 -0400 Subject: [PATCH 2/3] Review feedback --- docs/messaging.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/messaging.rst b/docs/messaging.rst index d7cde86a..5bcc29ea 100644 --- a/docs/messaging.rst +++ b/docs/messaging.rst @@ -1049,9 +1049,10 @@ multiple cases: IPythonQt client) to force a kernel restart to get a clean kernel without losing client-side state like history or inlined figures. -A restart should only restart the kernel and its subprocesses and not any -parent processes. That is, a restart should be "in-place". For local kernels, -there is typically no parent process so a "hard" restart and an in-place +A restart should optimally preserve as many resources outside the kernel as +possible (e.g. only restart the kernel and its subprocesses and not any +parent processes). That is, ideally a restart should be "in-place". For local +kernels, there is typically no parent process so a "hard" restart and an in-place restart are identical whereas for remote kernels this is not generally the same. .. versionchanged:: 5.4 From 76c9a62ce85ea2c2946b33d294942fcaa565bce7 Mon Sep 17 00:00:00 2001 From: Marc Udoff Date: Wed, 6 Sep 2023 08:54:01 -0400 Subject: [PATCH 3/3] Fix review comments --- docs/messaging.rst | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/messaging.rst b/docs/messaging.rst index 5bcc29ea..b0b9c5d7 100644 --- a/docs/messaging.rst +++ b/docs/messaging.rst @@ -1049,13 +1049,14 @@ multiple cases: IPythonQt client) to force a kernel restart to get a clean kernel without losing client-side state like history or inlined figures. -A restart should optimally preserve as many resources outside the kernel as -possible (e.g. only restart the kernel and its subprocesses and not any -parent processes). That is, ideally a restart should be "in-place". For local -kernels, there is typically no parent process so a "hard" restart and an in-place -restart are identical whereas for remote kernels this is not generally the same. - -.. versionchanged:: 5.4 +Implementation recommendation for starting kernels: A restart should optimally +preserve as many resources outside the kernel as possible (e.g. only restart the +kernel and its subprocesses and not any parent processes). That is, ideally a +restart should be "in-place". For local kernels, there is typically no parent +process so a "hard" restart and an in-place restart are identical whereas for +remote kernels this is not generally the same. As an example, if a remote kernel +is run in a container, during an in-place restart the container may be kept +running and a new kernel process within it would be started. The client sends a shutdown request to the kernel, and once it receives the reply message (which is otherwise empty), it can assume that the kernel has