cassinyio / SwarmSpawner

This repo is deprecated. A spawner for JupyterHub
BSD 3-Clause "New" or "Revised" License
23 stars 36 forks source link

Problems with driver_configs #23

Open mckinsel opened 7 years ago

mckinsel commented 7 years ago

Commit c37c79f639ad42832ad0ac4220777ae54c9247f5 added support for driver_configs in mounts. But this actually made driver_configs stop working for me. I think there are two reasons. First, if m['driver_config'] is a docker.types.services.DriverConfig, then it is a dict with key Options not "options". And not every DriverConfig will have a "device" option; I think driver options vary by driver.

So this commit leads to KeyErrors for me. If I revert it, then driver_configs work again.

barrachri commented 7 years ago

Hi @mckinsel, can you past the error?

mckinsel commented 6 years ago

Sure, this is the error I see in the hub:

     Traceback (most recent call last):
       File "/usr/local/lib/python3.5/dist-packages/tornado/web.py", line 1511, in _execute
         result = yield result
       File "/usr/local/lib/python3.5/dist-packages/jupyterhub/handlers/login.py", line 84, in post
         yield self.spawn_single_user(user)
       File "/usr/local/lib/python3.5/dist-packages/jupyterhub/handlers/base.py", line 328, in spawn_single_user
         yield gen.with_timeout(timedelta(seconds=self.slow_spawn_timeout), f)
       File "/usr/local/lib/python3.5/dist-packages/jupyterhub/user.py", line 261, in spawn
         raise e
       File "/usr/local/lib/python3.5/dist-packages/jupyterhub/user.py", line 229, in spawn
         ip_port = yield gen.with_timeout(timedelta(seconds=spawner.start_timeout), f)
       File "/usr/local/lib/python3.5/dist-packages/swarmspawner-0.2.0a0-py3.5.egg/cassinyspawner/swarmspawner.py", line 298, in start
         device = m['driver_config']['options']['device'].format(
     KeyError: 'options'
mckinsel commented 6 years ago

This is what the mount actually contains:

{'type': 'volume', 'driver_config': {'Options': {'backing': 'shared'}, 'Name': 'cloudstor:aws'}, 'read_only': True, 'source': 'ro', 'target': 'ro'}

This is using the cloudstor plugin with Docker for AWS. This is the relevant part of the jupyter config:

cloudstor_shared_config = docker.types.DriverConfig(
    "cloudstor:aws",
    {"backing": "shared"})

shared_resource_mount = {
    "target": "ro",
    "source": "ro",
    "type": "volume",
    "read_only": True,
    "driver_config": cloudstor_shared_config}