[add] detect and recover from kernel auto restarts#5558
[add] detect and recover from kernel auto restarts#5558shibbas wants to merge 2 commits intonteract:mainfrom
Conversation
|
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/nteract/site/ATkM8NZdPXaB51a4yLx9MrX7cLCi |
|
Please let me know if you need me to provide any more information. |
rgbkrk
left a comment
There was a problem hiding this comment.
This is great and I learned a bit more RxJS while reviewing. Thanks!
| { | ||
| header: { msg_type: "status" }, | ||
| content: { execution_state: "starting" } | ||
| }) as Subject<any>, |
There was a problem hiding this comment.
Heh, this works nicely for tests. 😎
| /** | ||
| * Jupyter has options to automatically restart the kernel on crash for a max-retry of 5 retries. | ||
| * Monitor for the kernel to have successfully restarted (sent as a "restarting" status followed by a "starting"). | ||
| * If all 5 retries fail, the kernel status is reported as "dead". |
| * Monitor for the kernel to have successfully restarted (sent as a "restarting" status followed by a "starting"). | ||
| * If all 5 retries fail, the kernel status is reported as "dead". | ||
| * | ||
| * @oaram {ActionObservable} action$ ActionObservable for LAUNCH_KERNEL_SUCCESSFUL action |
|
|
||
| return kernel.channels.pipe( | ||
| kernelStatuses(), | ||
| pairwise(), |
There was a problem hiding this comment.
Wow this one is new to me, very cool.
| ), | ||
| tap(() => { | ||
| // to avoid getting stuck in the "starting" state, nudge kernel with kernel_info_request to bring the status to Idle. | ||
| // TODO: test can't seem to identify next on subject. For now, check before calling |
There was a problem hiding this comment.
Since channels is a plain observable in some of the tests rather than a subject, it doesn't have .next.
|
@rgbkrk Thanks for taking the time to review! @shibbas Heads up that automatic releases are now enabled on the repo (see https://github.com/nteract/nteract/discussions/5568 for more info). To support automated releases, please make sure that the commits in this PR adhere to the conventional commit format (see https://www.conventionalcommits.org/en/v1.0.0/). Once this PR is merged, a release will be triggered for the modified packages based on the commit message. |
Checklist
Context
This is PR for the issue mentioned at https://github.com/nteract/nteract/issues/5548
When the Jupyter option for kernel auto-restart is turned on (which it by default), then the kernel will be restarted on the server automatically. You get a "restarting" status followed by a "starting" message from the kernel. Server uses "restarting" only for auto-restart scenarios.
This PR adds a new epic to detect the successful auto-restart and nudge the kernel back into the idle state. Also raises an action that applications can use to raise notifications since the Kernel state is lost.
Only applicable to Jupyter host type.
Before
// Side note: The CSS for nteract_on_jupyter application seems to be broken in dev setup hence the weird cell layout.

After kernel auto-restart, status gets stuck in starting state and cell execution does not proceed.
After
After kernel auto-restart, kernel is back to Idle and cell execution can continue.
