Two Instances of Jupyter HUB

193 views
Skip to first unread message

J bhatt

unread,
Aug 3, 2018, 1:17:13 PM8/3/18
to Project Jupyter
We want to give users the ability to run classic notebook and jupyter lab separately on the same machine. I am trying to start another Instance of Jupyterhub with a different config file . 
Looks like the hub is starting fine , but it is not spawning a new server .
Can someone confirm if this is possible to do with the Jupyterhub architecture ? I have used different ports in the second instance .
Thanks
J
[
I 2018-08-03 11:56:04.564 JupyterHub app:1453] Hub API listening on http://127.0.0.1:8482/hub/
[I 2018-08-03 11:56:04.567 JupyterHub app:1176] Starting proxy @ http://*:8003/
[D 2018-08-03 11:56:04.567 JupyterHub app:1177] Proxy cmd: ['configurable-http-proxy', '--ip', '', '--port', '8003', '--api-ip', '127.0.0.1', '--api-port', '5433', '--default-target', 'http://127.0.0.1:8482', '--error-target', 'http://127.0.0.1:8482/hub/error', '--log-level', 'debug', '--ssl-key', '/app/anaconda3/srv/jupyterhub.key', '--ssl-cert', '/app/anaconda3/srv/jupyterhub.crt']
11:56:04.723 - info: [ConfigProxy] Adding route / -> http://127.0.0.1:8482
11:56:04.743 - info: [ConfigProxy] Proxying https://*:8003 to http://127.0.0.1:8482
11:56:04.744 - info: [ConfigProxy] Proxy API at http://127.0.0.1:5433/api/routes
[D 2018-08-03 11:56:04.774 JupyterHub app:1205] Proxy started and appears to be up
[I 2018-08-03 11:56:04.775 JupyterHub service:220] Starting service 'cull-idle': ['python', '/app/anaconda3/bin/cull_idle_servers.py', '--timeout=172800']
[I 2018-08-03 11:56:04.779 JupyterHub service:90] Spawning python /app/anaconda3/bin/cull_idle_servers.py --timeout=172800
[D 2018-08-03 11:56:04.782 JupyterHub spawner:584] Polling subprocess every 30s
[I 2018-08-03 11:56:04.783 JupyterHub app:1485] JupyterHub is now running at http://127.0.0.1:8003/
[I 2018-08-03 11:56:04.788 JupyterHub orm:163] Adding service formgrader to proxy /services/formgrader => http://127.0.0.1:8082
[D 2018-08-03 11:56:04.789 JupyterHub orm:146] Fetching POST http://127.0.0.1:5433/api/routes/services/formgrader
11:56:04.797 - info: [ConfigProxy] Adding route /services/formgrader -> http://127.0.0.1:8082
11:56:04.800 - info: [ConfigProxy] 201 POST /api/routes/services/formgrader
[I 2018-08-03 11:56:04.914 JupyterHub log:100] 200 GET /hub/api/users (cull-idle@127.0.0.1) 13.63ms
11:56:16.622 - debug: [ConfigProxy] PROXY WEB /hub/ to http://127.0.0.1:8482
[I 2018-08-03 11:56:16.639 JupyterHub log:100] 302 GET /hub/ (@::ffff:10.21.178.151) 3.38ms
11:56:16.708 - debug: [ConfigProxy] PROXY WEB /login to http://127.0.0.1:8482
[I 2018-08-03 11:56:16.717 JupyterHub log:100] 302 GET /login (@::ffff:10.21.178.151) 1.11ms
11:56:16.760 - debug: [ConfigProxy] PROXY WEB /hub/login to http://127.0.0.1:8482
[E 2018-08-03 11:56:16.763 JupyterHub web:1548] Uncaught exception GET /hub/login (::ffff:10.21.178.151)
   
HTTPServerRequest(protocol='https', host='c:8003', method='GET', uri='/hub/login', version='HTTP/1.1', remote_ip='::ffff:10.21.178.151', headers={'X-Forwarded-Host': 'server:8003', 'X-Forwarded-Proto': 'https', 'X-Forwarded-Port': '8003', 'X-Forwarded-For': '::ffff:10.21.178.151', 'Accept-Language': 'en-US,en;q=0.9', 'Accept-Encoding': 'gzip, deflate, br', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36', 'Upgrade-Insecure-Requests': '1', 'Connection': 'close', 'Host': 'server:8003'})
   
Traceback (most recent call last):
     
File "/app/anaconda3/lib/python3.6/site-packages/tornado/web.py", line 1467, in _execute
        result
= method(*self.path_args, **self.path_kwargs)
     
File "/app/anaconda3/lib/python3.6/site-packages/jupyterhub/handlers/login.py", line 62, in get
       
self.finish(self._render(username=username))
     
File "/app/anaconda3/lib/python3.6/site-packages/jupyterhub/handlers/login.py", line 37, in _render
        login_url
=self.settings['login_url'],
     
File "/app/anaconda3/lib/python3.6/site-packages/jupyterhub/handlers/base.py", line 413, in render_template
       
template = self.get_template(name)
     
File "/app/anaconda3/lib/python3.6/site-packages/jupyterhub/handlers/base.py", line 409, in get_template
       
return self.settings['jinja2_env'].get_template(name)
     
File "/app/anaconda3/lib/python3.6/site-packages/jinja2/environment.py", line 830, in get_template

ri...@globus.org

unread,
Aug 3, 2018, 7:53:48 PM8/3/18
to Project Jupyter
Hi,

You don’t need to run separate JupyterHub instances, you can achieve this by using a spawner that launches either the traditional Notebook Server or JupyterLab. A container spawner like Docker or Singularity works well for this use case. The user can be pretty prompted to select which one they want to spawn.

I’ll try to find a link to post with an example implementation.

—Rick

ri...@globus.org

unread,
Aug 3, 2018, 9:26:55 PM8/3/18
to Project Jupyter
Here are links to DockerSpawner and SingularitySpawner. The latter allows the user to specify the path to the Singularity image they want to use. 


You can override the text field in the form with radio buttons, here's an example of that:


--Rick

J bhatt

unread,
Aug 3, 2018, 10:32:32 PM8/3/18
to Project Jupyter
Thank you very much ! this really helps 

Michael Milligan

unread,
Aug 4, 2018, 12:08:59 PM8/4/18
to Project
Hi,

I'd like to mention ProfileSpawner (part of Wrapspawner) as an option here as well. It exists specifically to support multiple user-selectable spawner configurations in a single JupyterHub instance. It's actually your only option if you want to switch between multiple Spawner classes, but it also works quite well for smaller configuration tweaks like this, and is totally agnostic about which spawning mechanism you need to use.

https://github.com/jupyterhub/wrapspawner/



--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscribe@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/4b8f8751-185c-46de-a1fa-e21adfe22339%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Michael Milligan, Ph.D.         | Supercomputing Institute
Assistant Director for          | University of Minnesota
   Application Development      | mill...@umn.edu
www.msi.umn.edu/staff/milligan  | Phone: 612-624-8857

J bhatt

unread,
Aug 6, 2018, 10:47:04 AM8/6/18
to Project Jupyter
Thank you very much for all the options - 
I was wondering if I could use the config c.Spawner.options_form = Union() to update the config c.Spawner.default_url  to either "/tree" or "/lab" based on use preference .I could have 1 instance of jupyterhub and user can pick which one they want to start . 
Would that work ?
Please advise.
Thanks !

J bhatt

unread,
Aug 6, 2018, 5:35:22 PM8/6/18
to Project Jupyter
I was able to give users option to pick to either classic notebook or jupyterlab by adding this in the config 
c.Spawner.options_form = '<input name="c.Spawner.default_url" val="/lab"/><br>Please Choose <select name="letter" multiple="true"><option value="/lab">Jupyter Lab</option><option value="/tree">Classic Notebook</option></select>'



On Friday, August 3, 2018 at 1:17:13 PM UTC-4, J bhatt wrote:
Reply all
Reply to author
Forward
0 new messages