datalayer/jupyter-server-nbmodel

Sometimes results of cells execution are not propagated to model (missing `document_id`)

Opened this issue · 4 comments

This may not be a bug in jupyter-server-nbmodel, but certainly does have an impact on it.

Sometimes cells appear not to be executed at all - the execution counter is not set and the outputs are not shown.

image

However, inspecting with dev tools I see requests being sent:

image

When shared models are used it is the responsibility of the server extension to set the values, but maybe it does not do that?

I think this might be due to missing documentId. When if fails, this line leads assigns undefined:

const documentId = notebook.sharedModel.getState('document_id');

It seems to work with newly created files, but not with anything that was already open.

Current best guess: the code which should set this upstream (here) does not work correctly for files which are open before the docprovider extension initialises (or something similar).

On the side of this extension, if documentId is required for the request to work, maybe it should throw or show some user-facing error to shorten the debugging loop?

Closing and reopening affected notebooks seems to fix the issue. I will open an issue on jupyter-collaboration.

Ah, this happens when the RTC: prefix is missing. Here is the failure scenario:

  • user created a notebook and bookmarked it, say http://localhost:8080/lab/workspaces/auto-d/tree/Training.ipynb
  • user installs jupyter-server-nbmodel[lab]
  • user goes to the bookmark (http://localhost:8080/lab/workspaces/auto-d/tree/Training.ipynb) which opens the notebook, but execution in it does not update the state at all (but is performed in the kernel). User should have changed the bookmark to http://localhost:8080/lab/workspaces/auto-d/tree/RTC%3ATraining.ipynb but they would not know about this.

Also, if extension are executing docmanager:open command they need to add the RTC: prefix (but without URI encoding).

I guess there are two ways forward:

  • ensure that documents not handled by RTC docprovider fallback to the default execution and have a way to communicate this to the user
  • finish up jupyterlab/jupyterlab#16556 to enable jupyterlab/jupyterlab#16141 and make the RTC docprovider swap the default drive getting rid of the RTC prefix (preferable)