jupyter-server/kernel_gateway

/api/sessions implements a deprecated model

futurist opened this issue · 2 comments

When called from MainKernelHandler.post with below post data for end point /api/sessions:

kernel: {"id": null, "name": "python3"}
name: ""
path: "test.ipynb"
type: "notebook"

The returned json:

{
  "id": "982130c2-d1ad-4fe1-928f-46939323729c",
  "kernel": {
    "id": "bdba0b8f-942f-4b5c-82cb-4a356409b3fa",
    "name": "python3",
    "last_activity": "2018-09-24T02:47:30.362872Z",
    "execution_state": "idle",
    "connections": 0
  },
  "notebook": {
    "path": "test.ipynb",
    "name": ""
  }
}

Which should be:

{
  "id": "982130c2-d1ad-4fe1-928f-46939323729c",
  "path": "test.ipynb",
  "name": "",
  "type": "notebook",
  "kernel": {
    "id": "bdba0b8f-942f-4b5c-82cb-4a356409b3fa",
    "name": "python3",
    "last_activity": "2018-09-24T02:47:30.362872Z",
    "execution_state": "idle",
    "connections": 0
  },
  "notebook": {
    "path": "test.ipynb",
    "name": ""
  }
}

Problem The type, name, path is losted, which is not a valid model for the result.

This seems also same problem for a GET /api/sessions result.

How do you decide what is "a valid model"? Are there some client libraries that stopped working with our endpoints?

I don't see any lost data. The path and name are in the "notebook" section, and the presence of the "notebook" section indicates the type. But if newer versions of jupyter_client or other client-side libraries expect a different format, we should look into it.

The part of interface in the @jupyterlab/services defined below:

https://github.com/jupyterlab/jupyterlab/blob/562f485a6f03ed75004acbb9c2e73a81d1cc0f0b/packages/services/src/session/session.ts#L509

Now it expect a model.path etc. exists.

I'm try to create a PR in jupyterlab to fix the compatible with deprecated model format now.

jupyterlab/jupyterlab#5369