-
Notifications
You must be signed in to change notification settings - Fork 134
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
jupyter websocket messages not updating UI #369
Comments
When using nbformat 4.5+, each cell has an {
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"id": "0584ae61",
"metadata": {},
"outputs": [],
"source": [
"i=4"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "8963b4cb",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"4\n"
]
}
],
"source": [
"print(i)"
]
} I don't see the |
Whenever you refresh the page, you'll notice that the cellId in the websocket message is different, even if it's technically the same cell. This would imply that there's no relation with the cellId in the websocket message and the cellId in the cell field. |
ok. It could also imply there's a "disconnect" on some level with a gateway involved. Do you see the same behavior when not going through the gateway? |
So just to get some terms in sync, the gateway is the wss channel? That connects from the UI automatically |
I would say the gateway is a "kernel as a service" model. It has both HTTP and WSS APIs. All kernel interactions - whether that be for the kernel's lifecycle management (start, stop, interrupt, restart) or code execution (via websocket) are forwarded to the gateway from the notebook server when the gateway is configured. Otherwise, those same interactions occur locally (within the notebook server). The UI always goes through the notebook server to interact with the kernel. Of course, custom UIs can be built to interact with the gateway directly, but Notebook/Lab always go through their respective servers, and that server redirects to the gateway (when configured to do so). |
I'm wondering how does the frontend know what
cellId
each cell is? If I make a call to/api/contents/myfile.ipynb?content=1
, nocellId
appears on the returned file contents model.When I inspect the wss message that is sent from the frontend upon clicking the execute button in the UI (through the dev tools), I can see that the structure of the message is as follows:
When I refresh the page, the
cellId
for the same cell is always different. How is it tied to the UI's cells?I know that the
session
id is received upon making a get request to/api/kernels/{kernel_id}/channels
and from the docs,msg_id
seems to be randomly created fromstr(uuid.uuid4())
but how do cells become tied to particular ids? The only way I can get my code to appear under a cell in the UI is if I reuse the samemsg_id
that the frontend created upon clicking the run button on the UI (and if I do that, thensession
andcellId
can be empty since I guess it's inferred from themsg_id
)Not sure if this is the right place to ask this question, if not, please point me in the correct direction.
Thanks
Edit: From snooping around the UI, it looks like the model has a
cellId
. I have not verified manually trying to get the cellId through python or javascriptThe text was updated successfully, but these errors were encountered: