-
Notifications
You must be signed in to change notification settings - Fork 308
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
New kernels REST API #900
Comments
For the back-end to be able to make changes to a shared document based on some code execution, the back-end has to know which (part of a) document the code is linked to. For instance in a notebook, a cell input contains code that will produce outputs in the same cell. {
"document_id": "path/to/notebook.ipynb",
"cell_id": "b4d4a3fe-bc05-4965-b5eb-94732e4329ae",
"kernel_id": "c71c23dd-38ba-4967-aa46-415ba7317012"
} |
I would be in favor of extending the current kernels API in core to include a new REST endpoint for executing code. Something like
This wouldn't require a websocket to the kernel for two-way comms. It simply sends an execute_request to the kernel. On the server, this request would be handled by the KernelManager and formulated into a proper ZMQ message to be sent across kernels shell channel. I don't think we should replace any of the the current kernel's REST/Websocket API, though. The kernel websocket APIs are still heavily used by projects other than JupyterLab. We don't want those endpoints to degrade or deprecate anytime soon. As for checking kernel status, I think it also makes sense to add a |
This work is happening in jupyter-server/jupyverse#191. |
What would the impact for the Comm messages used by IPyWidgets? |
That's a good point, currently ipywidgets won't work with this, but there are discussions about using y-py in ipywidgets, which would be very aligned with this REST API in my opinion. |
Any pointers? Any backwards compatibly requirement taken in that discussion? |
I think it has been discussed in some meetings, but it's probably not going to happen anytime soon. |
I think it would be important to make it possible for clients to (easily) combine RTC experience with Comms. Having an example of how to do this would be helpful (but I agree that it might not be needed in the first iteration). |
I opened an issue in ipywidgets. |
I implemented a simple generic client based on the websocket interface (I tried using client: https://github.com/Wh1isper/jupyter_kernel_client Looking forward to your suggestions ! |
I would strongly suggest you use the |
We have started the work for an jupyter_server extension at https://github.com/datalayer/jupyter-server-nbmodel |
This repo doesn't seem to be public? |
Thanks @davidbrochart for the ping - it should now be public |
Confirmed, thanks! |
Looks like the current implementations target two goals:
Do we want to serve those 2 goals via the same endpoint or should we separate them. |
Why would output streams be lost? |
Demo for https://github.com/datalayer/jupyter-server-nbmodel using RTC model to update the notebook model on the server side from the kernel outputs (with jupyterlab/jupyter-collaboration#307) |
I was meaning that in the case 1 (Run some code via a HTTP POST without RTC), the server needs to wait the end of the execution before sending back the result. In that case, the client receives the complete outputs at once, so can not show the user the progress in streaming. Does it make sense? |
I don't see a lot of value in that. |
In this mode, websocket (the current JupyterLab implementation) seems the only option |
Thanks for creating this awosome project! I took a quick look at the code and left with two questions:
Feel free to discuss them with me anytime! :D |
Update on the jupyter server extension:
Prerequisites:
Execution of a notebook only from the left user - the right view is a RTC collaborator only viewing in the demo: demo_server_side_exec3b.mp4Note The input prompt only appears for the user starting the execution request I added some sequence diagrams to explain what is going on there. |
Hi, @fcollonval @davidbrochart , currently server-side state persistence is only supported by JupyVerse, will this ticket allow Jupyter-server based platforms to do the same? |
Problem
Currently, the kernel protocol over ZMQ in the back-end is "forwarded" to the front-end over a WebSocket. This brings a lot of complexity to the front-end, which has to speak this protocol.
With JupyterLab moving to RTC, the (notebook) UI becomes merely a shared document editor: the user enters some text in a cell, asks for execution, sees outputs being populated, clears outputs... There is no need for the front-end to e.g. interpret IOPub messages in order to display results, all this could be done in the back-end and directly modify the shared document, which would automatically update in the front-end.
Proposed Solution
We could create a much more simple REST API for kernels, which would consist of e.g. "POST execute request", etc.
All kernel state information (idle, busy, dead, restarting...) could go to the new event system.
The text was updated successfully, but these errors were encountered: