danielfrg / s3contents

Jupyter Notebooks in S3 - Jupyter Contents Manager implementation
Apache License 2.0
248 stars 88 forks source link

No root manager found #95

Closed max7866 closed 4 years ago

max7866 commented 4 years ago

Hello, I am trying to use hybridcontents along with s3contentmanager and I have exhausted my options of troubleshooting. I was wondering if someone can help me here. I have deployed Jupyterhub and using DockerSpawner for my spanwer. I have added the code below to my JupyterHub Config but I don't see the bucket or my local directory being mapped. Docker logs show the following: Couldn't resolve path [] and no root manager supplied!

Config is below:

from s3contents import S3ContentsManager
from hybridcontents import HybridContentsManager
from notebook.services.contents.largefilemanager import LargeFileManager

#c = get_config()
c.Spawner.args = ['--NotebookApp.contents_manager_class="hybridcontents.HybridContentsManager"']
c.HybridContentsManager.manager_classes = {
    # Associate the root directory with a LargeFileManager,
    # This manager will receive all requests that don't fall under any of the
    # other managers.
    # If you want to make this path un-editable you can configure it to use a read-only filesystem
    'directory': LargeFileManager,
    # Associate the s3 directory with AWS S3
    's3': S3ContentsManager,
}

c.HybridContentsManager.manager_kwargs = {
    # Args for root FileContentsManager.
    'directory': {
        'root_dir': '/home/jovyan/work',
    },
    # Args for the S3ContentsManager mapped to /directory
    "s3": {
        "access_key_id": "somekey",
        "secret_access_key": "someSecret",
        "endpoint_url": "s3.amazonaws.com",
        "bucket": "someBucket",
        "prefix": "",
    },
}
ericdill commented 4 years ago

You need something that maps to "". If you look at the Access local files heading of the readme, you can see there are two manager_classes defined. One is associating the root directory of the jupyter contentsmanager ("": S3ContentsManager,) and the other is associating a subdirectory called local_directory.

If you change 'directory' to just an empty string (''), things should work fine

ericdill commented 4 years ago

Please feel free to reopen this issue if the above didn't resolve your problem