Skip to content

Multi User Deployment with JupyterHub

Zebula Sampedro edited this page May 5, 2017 · 5 revisions

Overview

Sandstone HPC can be deployed on a multi-user system using JupyterHub as a server spawner. In addition to a working JupyterHub installation, you will need to install and configure:

sandstone-jupyterhub-login

Installing via Pip

To install using Pip

pip install sandstone-jupyterhub-login

Installing from Source

Clone sandstone-jupyterhub-login, and then install the Python module to your Sandstone IDE environment

python setup.py install

Configuring

Then modify your Sandstone IDE configuration to use the Sandstone JupyterHub Login and Logout handlers, and to pull the URL prefix from the environment.

import os

LOGIN_HANDLER = 'sandstone_jupyterhub_login.handlers.JupyterHubLoginHandler'
LOGOUT_HANDLER = 'sandstone_jupyterhub_login.handlers.JupyterHubLogoutHandler'

URL_PREFIX = os.environ.get('SANDSTONE_PREFIX', '')

JupyterHub can now invoke Sandstone IDE by running

<sandstone-python-path>/bin/sandstone-jupyterhub

Using self-signed certificates

If you have deployed JupyterHub over SSL using a self-signed certificate, then you must deconfigure verification in the login handler:

VERIFY_JH_CERT = False

sandstone-spawner

JupyterHub Spawner class for starting Sandstone HPC user instances

Install via Pip

To install using Pip

pip install sandstone-spawner

Install from Source

Clone sandstone-spawner, and then install the module with

python setup.py install

Configuration

Set the SANDSTONE_SETTINGS environment variable to the absolute path of your Sandstone settings file, and then set the SANDSTONE_APP_PATH environment variable to the absolute path of the sandstone-jupyterhub executable. This executable is provided by sandstone-jupyterhub-login.

export SANDSTONE_APP_PATH=/path/to/sandstone-jupyterhub

Modify your JupyterHub config file to set the default spawner as SandstoneSpawner.

c.JupyterHub.spawner_class = 'sandstone_spawner.spawner.SandstoneSpawner'

Spawn Jupyter Notebooks and Sandstone

If you would like JupyterHub to be able to spawn Sandstone as well as Jupyter Notebooks, configure the ProfilesSpawner to wrap the SandstoneSpawner:

c.JupyterHub.spawner_class = 'wrapspawner.ProfilesSpawner'
c.Spawner.http_timeout = 120

c.ProfilesSpawner.profiles = [
    ('Sandstone HPC', 'sandstone','sandstone_spawner.spawner.SandstoneSpawner', {}),
    ("Jupyter Notebook", 'local', 'jupyterhub.spawner.LocalProcessSpawner', {'ip':'0.0.0.0'}),
]