Difference in mounts type between c.SwarmSpawner.container_spec and user_options?
isuftin opened this issue · 3 comments
isuftin commented
This works:
mounts = [{
'type': 'volume',
'source': 'jupyterhub-user-{username}',
'target': notebook_dir
}]
c.SwarmSpawner.container_spec = {
'args': ['/usr/local/bin/start-singleuser.sh'],
'Image': os.getenv('SINGLE_USER_IMAGE', 'jupyterhub/singleuser:latest'),
'mounts': mounts
}
This does not:
mounts = [{
'type': 'volume',
'source': 'jupyterhub-user-{username}',
'target': notebook_dir
}]
c.SwarmSpawner.use_user_options = True
user_options = {
'container_spec' : {
'args': ['/usr/local/bin/start-singleuser.sh'],
'Image': os.getenv('SINGLE_USER_IMAGE', 'jupyterhub/singleuser:latest'),
'mounts': mounts,
'placement' : ["node.Role == worker"],
'network' : [os.getenv('SWARMSPAWNER_JUPYTERHUB_NETWORKS', 'jupyterhub_dlcc_network')],
'name' : os.getenv('SWARMSPAWNER_JUPYTERHUB_SERVICE_NAME', 'jupyterhub_jupyterhub')
}
}
Error seen:
jupyterhub_jupyterhub.1.rv400s2ujiec@myservice | Traceback (most recent call last):
jupyterhub_jupyterhub.1.rv400s2ujiec@myservice | File "/opt/conda/lib/python3.5/site-packages/tornado/web.py", line 1469, in _execute
jupyterhub_jupyterhub.1.rv400s2ujiec@myservice | result = yield result
jupyterhub_jupyterhub.1.rv400s2ujiec@myservice | File "/opt/conda/lib/python3.5/site-packages/jupyterhub/handlers/base.py", line 535, in get
jupyterhub_jupyterhub.1.rv400s2ujiec@myservice | yield self.spawn_single_user(current_user)
jupyterhub_jupyterhub.1.rv400s2ujiec@myservice | File "/opt/conda/lib/python3.5/site-packages/jupyterhub/handlers/base.py", line 328, in spawn_single_user
jupyterhub_jupyterhub.1.rv400s2ujiec@myservice | yield gen.with_timeout(timedelta(seconds=self.slow_spawn_timeout), f)
jupyterhub_jupyterhub.1.rv400s2ujiec@myservice | File "/opt/conda/lib/python3.5/site-packages/jupyterhub/user.py", line 261, in spawn
jupyterhub_jupyterhub.1.rv400s2ujiec@myservice | raise e
jupyterhub_jupyterhub.1.rv400s2ujiec@myservice | File "/opt/conda/lib/python3.5/site-packages/jupyterhub/user.py", line 229, in spawn
jupyterhub_jupyterhub.1.rv400s2ujiec@myservice | ip_port = yield gen.with_timeout(timedelta(seconds=spawner.start_timeout), f)
jupyterhub_jupyterhub.1.rv400s2ujiec@myservice | File "/opt/conda/lib/python3.5/site-packages/swarmspawner-0.1.0-py3.5.egg/cassinyspawner/swarmspawner.py", line 285, in start
jupyterhub_jupyterhub.1.rv400s2ujiec@myservice | for mount in self.container_spec['mounts']:
jupyterhub_jupyterhub.1.rv400s2ujiec@myservice | KeyError: 'mounts'
isuftin commented
Also, I want to make sure I understand how this works. Does the user_options dict go into the jupyterhub_config.py??
barrachri commented
Hi @isuftin
you can pass some specs for your instance using a form (the user can do this).
To accepts the passed parameters you need to set:
c.SwarmSpawner.use_user_options = True
Otherwise the parameters passed by the user (through the jupyterhub website) won't be accepted.
isuftin commented
@barrachri Ok thank you. Then this was a misunderstanding on my part as to the use of the user_options
dict. I thought it was to go into the jupyterhub_config.py file.