-
Notifications
You must be signed in to change notification settings - Fork 310
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
[Proposal] Jupyter Server should handle resolving kernel lifecycle and execution states. #990
Comments
It's probably out of scope for now, but I believe that it would be useful if in future kernels could provide progress updates (rather than simple idle/busy). The proposed response format seems easily extensible to include e.g. I would say that for user experience the latency matters here so if implementation as an event means that there is no delay due to pooling in longer intervals it might be better (but I have no insight if that is the case). |
Coming back here from jupyterlab/jupyterlab#16059. This proposal would solve jupyterlab/jupyterlab#16059 (the kernel status could be properly updated after refresh), but it does not solve the problem of status for individual cells. I am talking about the execution indicators like In jupyterlab/jupyterlab#16059 I was thinking about storing the information about pending execution on frontend. Because a pending execution request may have been completed during page reload, frontend would need a way to ask the kernel (server?) about the status of that execution request (which can be identified by message id). This could be solved by extending the proposed jupyter-server API with:
jupyter-server would then keep track of the kernel status updates in a dictionary with binary values. Thoughts? (and in future those could be made floats to represent progress ;)) |
Going a step further, I think the long-term solution is having server-side execution, and not having frontends deal with the kernel protocol in the first place. |
Server-side execution as implemented in jupyterlab/jupyterlab#15448 does not solve jupyterlab/jupyterlab#16059 itself. I think these two solutions are working in lockstep. |
Not yet, but for instance jupyter-server/jupyter_ydoc#197 goes in that direction. The cell execution state could be included in the notebook shared model, and the kernel execution state could be inferred from all cells' execution state. |
I think this is a reasonable idea to store these in the shared model. In any case, I think we need more than What I am saying is that maybe we need to store a list of objects mapping to each of the pending execution requests. Something like: class Cell:
pending_requests: Request[]
class Request:
id: str
type: 'stdin_request' | 'execute_request' Now, |
Frontend applications should be able to fetch the lifecycle states (starting, connecting, connected, terminating, dead, restarting, ...) and execution states (busy, idle, etc.) of a given kernel. The server should be in charge of resolving these states, since it talks directly to the kernel.
As mentioned in previous issue, today, frontends are forced to resolve the kernel states by tracking IOPub status messages. There are many problems with relying on the client to listen to the IOPub stream. See that issue for more details.
I propose that we make Jupyter Server's kernel manager responsible for storing, tracking, and returning the state of its kernel. We should add a REST API to the kernels service to fetch the state of a kernel, e.g.
We can also consider leveraging the Jupyter Event system to emit notifications with the kernel state changes.
This proposal would address #989
The text was updated successfully, but these errors were encountered: