New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Rework kernel status #4724
Conversation
Related issue about notifying on kernel status change: #4748 |
@minrk and I talked more about this today. Here are some thoughts: The kernel states are conflating the connection status with the kernel status. Actually, there are three sources for status here: the client (mostly dealing with connection state), the notebook server (dealing with kernel management, like a Perhaps we need two states: the connection state and the kernel state. When we are in the disconnected state, the kernel state is Another thing: on restart, don't create a new websocket connection to the kernel. Keep the existing connection, and we'll receive the restarting event. Here are some scenarios: New Kernel start
Kernel connection to existing kernel Kernel restart Don't disconnect the kernel in this entire process.
|
A big question: do we want the kernel status / signal to be only some specific values, or do we want to acknowledge kernels can have their own optional status? Do we want the kernel's status to just be a string? Or do we want to ignore status values we don't understand? |
Sounds good
It doesn't look like it is optional here.
Sounds good
I'd say forward them all since kernel-specific extensions may want that information |
Perhaps also the connected state should just be a boolean flag, rather than also having a 'connecting' state signaling when we are actively trying to connect. |
I think connection state should be: |
We are disconnected if we explicitly disconnect or give up on retries. |
I guess we want to make sure the user knows through some UI element that we are trying to connect, so I think you're right that it makes sense to make that a specific state. |
See the open PR to jupyter_client, based on conversations with @minrk about kernel status: jupyter/jupyter_client#388 |
@jasongrout are you still wanting this to get into Monday's 0.34 release? |
By the way, we were also discussing lots of updates to that document: jupyter/jupyter_client#388 |
In the kernel restart scenario in #4724 (comment), we should switch steps 2 and 3, so that a user can listen for the 'restarting' status and in that handler, await the kernel ready promise. So the revised steps look like: Kernel restart Don't disconnect the kernel in this entire process.
|
Some further simplifications based on conversations with @saulshanabrook, @blink1073:
So now the scenarios look like: New Kernel start
Kernel connection to existing kernelExactly like the new kernel start, but we don't request a kernel start, but just initiate a websocket connection to the url we already know. Kernel restartDon't disconnect the kernel in this entire process.
Execute code when kernel is resetImmediately send the kernel message (which will be queued if necessary). Also, connect to the kernel status, and send the kernel message when the status changes to |
@saulshanabrook, @blink1073, can you look at the new writeup at #4724 (comment) ? |
As you can see, I've dug deeper and deeper into how we expose kernel status and other information, including peeling back the session and clientsession objects we have. There were a lot of really confusing dependencies between those concepts. Here's another thought: how about we get rid of the concept of sessions entirely, at least for most users. They're not extremely useful to us as an abstraction. We would probably still use the concept of sessions in the background to maintain a mapping between kernels and documents, but what is exposed to the user on a document context would be just a kernel, plain and simple. Or perhaps a kernel container of some kind that was very lightweight (i.e., had a kernel attribute, and a kernelChanged signal, or something). Behind the scenes, if you wanted to associate document paths with kernels, you could, and then those would be persisted to the server, but it wouldn't be necessary for things to use sessions. |
I am 100% in favor of removing unneeded abstractions! Happy to walk through this with you tomorrow. |
To elaborate more: let's make kernels first-class objects in JLab. Like you should be able to start a kernel with no attached activity, and a kernel should (optionally?) be able to live beyond any document associated with it. |
…eturn undefined if the object was not found. This makes it more consistent with standard Javascript practices, and preserves the errors for true errors.
This simplified logic quite a bit. Most of these ideas came from previous work in jupyterlab#4724
This simplified logic quite a bit. Most of these ideas came from previous work in jupyterlab#4724
This is being superseded by #7252 |
Related to work in and built on top of #4697.