Skip to content
This repository has been archived by the owner on Jan 16, 2018. It is now read-only.

SwarmSpawner Expects Different Format for inspect_service #13

Closed
twavv opened this issue Jul 29, 2017 · 2 comments
Closed

SwarmSpawner Expects Different Format for inspect_service #13

twavv opened this issue Jul 29, 2017 · 2 comments

Comments

@twavv
Copy link
Contributor

twavv commented Jul 29, 2017

Using what I think is a pretty standard installation... I can't quite get it to work.

jupyterhub.1.2fird3hjs8nf@bluebonnet    |     HTTPServerRequest(protocol='http', host='bluebonnet.eecs.umich.edu:8000', method='POST', uri='/hub/login?next=', version='HTTP/1.1', remote_ip='::ffff:10.255.0.2', headers={'Content-Length': '45', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36', 'X-Forwarded-Proto': 'http', 'Accept-Language': 'en-US,en;q=0.8', 'Cache-Control': 'max-age=0', 'Cookie': 'AMCV_4D6368F454EC41940A4C98A6%40AdobeOrg=-1330315163%7CMCIDTS%7C17238%7CMCMID%7C08480496867647127562896913634378802334%7CMCAAMLH-1489883949%7C7%7CMCAAMB-1489883949%7CNRX38WO0n5BH8Th-nqAG_A%7CMCOPTOUT-1489286349s%7CNONE%7CMCAID%7CNONE; s_pers=%20c19%3Dpr%253Apublications%253Aview%7C1489281780740%3B%20v68%3D1489279980474%7C1489281780743%3B%20v8%3D1489279989599%7C1583887989599%3B%20v8_s%3DFirst%2520Visit%7C1489281789599%3B; __utma=7269686.1234911664.1489279149.1489546566.1489546566.1; __utmz=7269686.1489546566.1.1.utmcsr=www-personal.umich.edu|utmccn=(referral)|utmcmd=referral|utmcct=/; _ceg.s=otpdxa; _ceg.u=otpdxa; gwlob=on; _ga=GA1.2.1234911664.1489279149; _gid=GA1.2.2068178188.1501350351', 'Upgrade-Insecure-Requests': '1', 'Content-Type': 'application/x-www-form-urlencoded', 'Referer': 'http://bluebonnet.eecs.umich.edu:8000/hub/login', 'Accept-Encoding': 'gzip, deflate', 'X-Forwarded-For': '::ffff:10.255.0.2', 'X-Forwarded-Host': 'bluebonnet.eecs.umich.edu:8000', 'Connection': 'close', 'X-Forwarded-Port': '8000', 'Host': 'bluebonnet.eecs.umich.edu:8000', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8', 'Origin': 'http://bluebonnet.eecs.umich.edu:8000'})
jupyterhub.1.2fird3hjs8nf@bluebonnet    |     Traceback (most recent call last):
jupyterhub.1.2fird3hjs8nf@bluebonnet    |       File "/opt/conda/lib/python3.5/site-packages/tornado/web.py", line 1511, in _execute
jupyterhub.1.2fird3hjs8nf@bluebonnet    |         result = yield result
jupyterhub.1.2fird3hjs8nf@bluebonnet    |       File "/opt/conda/lib/python3.5/site-packages/jupyterhub/handlers/login.py", line 99, in post
jupyterhub.1.2fird3hjs8nf@bluebonnet    |         yield self.spawn_single_user(user)
jupyterhub.1.2fird3hjs8nf@bluebonnet    |       File "/opt/conda/lib/python3.5/site-packages/jupyterhub/handlers/base.py", line 347, in spawn_single_user
jupyterhub.1.2fird3hjs8nf@bluebonnet    |         yield gen.with_timeout(timedelta(seconds=self.slow_spawn_timeout), f)
jupyterhub.1.2fird3hjs8nf@bluebonnet    |       File "/opt/conda/lib/python3.5/site-packages/jupyterhub/user.py", line 310, in spawn
jupyterhub.1.2fird3hjs8nf@bluebonnet    |         raise e
jupyterhub.1.2fird3hjs8nf@bluebonnet    |       File "/opt/conda/lib/python3.5/site-packages/jupyterhub/user.py", line 278, in spawn
jupyterhub.1.2fird3hjs8nf@bluebonnet    |         ip_port = yield gen.with_timeout(timedelta(seconds=spawner.start_timeout), f)
jupyterhub.1.2fird3hjs8nf@bluebonnet    |       File "/srv/jupyterhub/SwarmSpawner/cassinyspawner/swarmspawner.py", line 324, in start
jupyterhub.1.2fird3hjs8nf@bluebonnet    |         for line in service['Config']['Env']:
jupyterhub.1.2fird3hjs8nf@bluebonnet    |     KeyError: 'Config'

It looks like docker-py is returning it in this format, which doesn't contain a top level 'Config' object.

  "Version": {
    "Index": 141
  },
  "UpdatedAt": "2017-07-29T17:55:52.91611666Z",
  "Endpoint": {
    "VirtualIPs": [
      {
        "NetworkID": "nvtqnxhtejra3ofdgkeae501m",
        "Addr": "10.0.0.6/24"
      }
    ],
    "Spec": {}
  },
  "CreatedAt": "2017-07-29T17:55:52.843555567Z",
  "ID": "8dkpq7htzhlt8tfisykzrbize",
  "Spec": {
    "Mode": {
      "Replicated": {
        "Replicas": 1
      }
    },
    "Labels": {},
    "Networks": [
      {
        "Target": "nvtqnxhtejra3ofdgkeae501m"
      }
    ],
    "TaskTemplate": {
      "ForceUpdate": 0,
      "Runtime": "container",
      "ContainerSpec": {
        "Image": "jupyterhub/singleuser",
        "Env": [
          "JUPYTERHUB_API_TOKEN=b05caf788dd74c91af51fb86834348e9",
          "JUPYTERHUB_OAUTH_CALLBACK_URL=/user/jovyan/oauth_callback",
          "JUPYTERHUB_CLIENT_ID=user-jovyan",
          "JPY_HUB_API_URL=http://jupyterhub:8081/hub/api",
          "JPY_USER=jovyan",
          "JUPYTERHUB_HOST=",
          "JPY_COOKIE_NAME=jupyter-hub-token-jovyan",
          "JPY_BASE_URL=/user/jovyan",
          "JPY_HUB_PREFIX=/hub/",
          "JPY_API_TOKEN=b05caf788dd74c91af51fb86834348e9"
        ]
      }
    },
    "Name": "jupyter-45bfb35c3cbdca8d0c12590895195086-1"
  }
}

For reference, my jupyterhub_config.py is

import os
network_name = 'jupyterhub'

c.JupyterHub.log_level = 'DEBUG'

c.JupyterHub.spawner_class = 'cassinyspawner.SwarmSpawner'
c.JupyterHub.hub_ip = "0.0.0.0"
c.JupyterHub.proxy_api_ip = "0.0.0.0"
c.SwarmSpawner.jupyterhub_service_name = "jupyterhub"
c.SwarmSpawner.networks = ["jupyterhub"]
c.SwarmSpawner.container_spec = {
                  # The command to run inside the service
                  # 'args' : ['/usr/local/bin/start-singleuser.sh'], # (list)
                  'Image' : 'jupyterhub/singleuser',
                  'mounts' : []
          }

#c.JupyterHub.spawner_class = 'dockerspawner.DockerSpawner'
#c.DockerSpawner.use_internal_ip = True
#c.DockerSpawner.network_name = network_name
# Pass the network name as argument to spawned containers
#c.DockerSpawner.extra_host_config = { 'network_mode': network_name }
#c.DockerSpawner.extra_start_kwargs = { 'network_mode': network_name }


# User containers will access hub by container name on the Docker network
#c.JupyterHub.hub_ip = 'jupyterhub'
#c.JupyterHub.hub_port = 8000

# The docker instances need access to the Hub, so the default loopback port doesn't work:
#c.JupyterHub.hub_ip = 'jupyterhub'
#c.JupyterHub.ip = 'jupyterhub'
#c.DockerSpawner.container_ip = "0.0.0.0"
#c.DockerSpawner.hub_ip_connect = 'jupyterhub'


c.JupyterHub.authenticator_class = 'dummyauthenticator.DummyAuthenticator'
c.DummyAuthenticator.password = "your strong password"

and the image for Jupyterhub is derived from jupyterhub/jupyterhub.

@barrachri
Copy link

Hello @TraviGD can you send a PR with service['TaskTemplate']['Env']?
It should work.

@barrachri
Copy link

#14

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants