question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SwarmSpawner Persistence of user notebook directories error

See original GitHub issue

I use add the lines below in jupyterhub_config.py:

notebook_dir = os.environ.get('DOCKER_NOTEBOOK_DIR') or '/home/jovyan/work' c.DockerSpawner.notebook_dir = notebook_dir c.DockerSpawner.volumes = { 'jupyterhub-user-{username}': notebook_dir }

It is use to persist user notebook directories. And got an error:

Incompatible options have been provided for the bind

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

12reactions
zi-dancommented, Oct 4, 2018

I spent a lot of time to resolve issue with not working volumes with SwamSpawner. Finally I resolved it by:

  • mounting NFS storage on each node,
  • bind NFS volume to JupyterHub container
  • create user volume on NFS storage by Spawner.pre_spawn_hook by following code snippets:
def create_dir_hook(spawner):
    username = spawner.user.name  # get the username
    volume_path = os.path.join('/nfs/path/dir', username)
    if not os.path.exists(volume_path):
        os.mkdir(volume_path, 0o755)
    mounts_user = [
                   {'type': 'bind',
                    'source': '/nfs/path/dir/' + username,
                    'target': '/home/jovyan/work', }
                   ]
    spawner.extra_container_spec = {
        'mounts': mounts_user
    }

# attach the hook function to the spawner
c.Spawner.pre_spawn_hook = create_dir_hook

I know it is workaround but is only way to attach user directory in SwarmSpawner mode.

2reactions
ivanjz93commented, Jul 27, 2018

@sangramga Thanks for replying! I tryed it, but still got the error. After reading the code of SwarmSpawner, I found that maybe there may be a problem here: 2018-07-27 3 03 50

driver_config (DriverConfig): Volume driver configuration. Only valid for the volume type.

But our type is “bind” here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

DockerSpawner API - Read the Docs
The user sees a file listing of this directory when the notebook interface is started. The current interface does not easily allow browsing...
Read more >
jupyterhub/jupyterhub - Gitter
Hi all, I am using JupyterHub to start docker containers using DockerSpawner. I want a directory in there to be automatically mounted to...
Read more >
Spawn failed for user after jupyterhub restart, received signal ...
spawn failed for user after jupyterhub restart, log shows. received signal 15, stopping SingleUserLabApp notebookapp:2052] Shutting down 0 kernels
Read more >
JupyterHub Documentation - Read the Docs
level directory users will be able to access in the notebook dashboard. ... JupyterHub 0.8 adds the ability to persist state related to ......
Read more >
Deploying Jupyter Notebooks at scale on XSEDE resources ...
Finally, we can configure SwarmSpawner so that the first time a user requests a Jupyter Notebook, a Docker. Volume is created as a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found