jupyter-fs icon indicating copy to clipboard operation
jupyter-fs copied to clipboard

Setup via jupyter_notebook_config.py not respected (Server-Side Settings)

Open JohnOmernik opened this issue 4 years ago • 4 comments

Hello all, I've read through the readme, and am trying to figure out if what I am doing is wrong, and this is expected, or if I should be able to achieve this (which for me, all setup occurs in jupyter_notebook_config.py, I do this so I can automate this install for folks).

Essentially,

I inferred from the Readme (Note: If this is accurate, we should make this explicit under Server-Side Settings) that I can put this in the jupyter_notebook_config.py to set the contents_manager_class and enabled the plugin.

c.NotebookApp.contents_manager_class = "jupyterfs.metamanager.MetaManager"
c.NotebookApp.nbserver_extensions = {"jupyterfs.extension": True}

Then, per the Server-Side Settings (This part IS explicit) I added a couple of locations for testing:

c.Jupyterfs.resources = [
    {
        "name": "mytest1",
        "url": "osfs:///Users/iamgroot/Notebooks"
    },
    {
        "name": "mytest2",
        "url": "osfs:///Users/iamgroot"
    },
]

When I restart my notebook server this does NOT work.

Nothing new appears. However, when I open the Advanced Settings Editor, go to jupyter-fs and add:

{
	"resources": [
    {
        "name": "mytest1",
        "url": "osfs:///Users/iamgroot/Notebooks"
    },
    {
        "name": "mytest2",
        "url": "osfs:///Users/iamgroot"
    }
    ]
}

Then I get two new items with the proper root as expected.

Note, when I do this, I don't change the jupyter_notebook_config.py so all the other information is there

I am using Anaconda, I am not sure if that could affect things.

Essentially, I would like to be able to do ALL the setup in the jupyter_notebook_config.py without having to touch any of the json files/UI settings. This allows me to automate a setup for my users.

Any thoughts would be appreciated.

JohnOmernik avatar Jan 06 '21 14:01 JohnOmernik

I'm also having problems with server-side settings. I've tried to specify jupyter_server_config.json, but the sidebar pane stays empty.

image

Unfortunately, I cannot reproduce the issue. This minimal example results in a correctly functional sidebar pane:

FROM jupyter/base-notebook

RUN pip install jupyter-fs

RUN echo '{ \
    "ServerApp": { \
    "contents_manager_class": "jupyterfs.metamanager.MetaManager", \
    "jpserver_extensions": { \
    "jupyterfs.extension": true \
    } \
    }, \
    "Jupyterfs": { \
    "resources": [ \
    { \
    "name": "HOME", \
    "url": "osfs:///home/jovyan" \
    } \
    ] \
    } \
    }' > /etc/jupyter/jupyter_server_config.json

StefanBrand avatar Mar 18 '22 14:03 StefanBrand

I can reproduce with the eurodatacube/jupyter-user-base image that we are also using internally.

FROM eurodatacube/jupyter-user-base:10

RUN pip install jupyter-fs

RUN echo '{ \
    "ServerApp": { \
    "contents_manager_class": "jupyterfs.metamanager.MetaManager", \
    "jpserver_extensions": { \
    "jupyterfs.extension": true \
    } \
    }, \
    "Jupyterfs": { \
    "resources": [ \
    { \
    "name": "HOME", \
    "url": "osfs:///home/jovyan" \
    } \
    ] \
    } \
    }' > /etc/jupyter/jupyter_server_config.json

Workaround

Interestingly, if I manually paste the config into the advanced settings, a second jupyter-fs pane appears and both the first and the second one display all files (rather than staying blank):

{
  "resources": [
    {
      "name": "HOME",
      "url": "osfs:///home/jovyan"
    }
  ]
}

Edit: Refreshing the page (F5) makes the sidebar blank again and a refresh can only be triggered by modifying the configuration in the Advanced Settings Editor.

StefanBrand avatar Mar 18 '22 14:03 StefanBrand

These are the error messages from the Console:

Uncaught (in promise) TypeError: this.table_model is undefined
    init tree-finder.js:28
    init tree-finder.js:32
    I treefinder.js:79
tree-finder.js:28:720
Uncaught (in promise) TypeError: this._table_clip is undefined
    draw tree-finder.js:1
tree-finder.js:1:14898

Relevant line in upstream source: https://github.com/telamonian/tree-finder/blob/1a1d48106d3a4764160f8d0bc1c1912c609a03c3/packages/tree-finder/src/element/grid.ts#L32

StefanBrand avatar Mar 18 '22 14:03 StefanBrand

Since I think that my issue is unrelated, I have opened a new one here: #129

StefanBrand avatar Mar 21 '22 10:03 StefanBrand