Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### AUTHENTICATION SETUP
- from oauthenticator.generic import GenericOAuthenticator
- OAUTH_CLIENT_ID = REDACTED
- OAUTH_CLIENT_SECRET = REDACTED
- c.JupyterHub.authenticator_class = GenericOAuthenticator
- c.Authenticator.admin_users = [REDACTED]
- c.JupyterHub.pid_file = '/opt/jupyterhub/jupyterhub-proxy.pid'
- c.JupyterHub.cookie_secret_file = '/opt/jupyterhub/jupyterhub_cookie_secret'
- ### DATABASE SETUP
- POSTGRES_HOST = REDACTED
- POSTGRES_USER = REDACTED
- POSTGRES_PASSWORD = REDACTED
- POSTGRES_DATABASE = REDACTED
- c.JupyterHub.db_url = "postgres://{}:{}@/{}?host={}".format(POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DATABASE, POSTGRES_HOST)
- ### SSL SETUP
- c.KernelManager.transport = 'ipc'
- c.JupyterHub.bind_url = 'http://:8000'
- c.JupyterHub.ssl_key = '/etc/jupyter/ssl/jupyterhub.key'
- c.JupyterHub.ssl_cert = '/etc/jupyter/ssl/jupyterhub.crt'
- c.JupyterHub.trusted_alt_names = ["DNS:jupyterhub.XXX.XXX"]
- c.JupyterHub.trusted_downstream_ips = ["IP:198.38.16.107"]
- #c.JupyterHub.internal_ssl = True
- #c.JupyterHub.internal_certs_location = '/etc/jupyter/ssl/internal-ssl'
- ### SPAWNER CONFIG
- import batchspawner
- c.JupyterHub.hub_connect_ip = '198.38.16.107'
- c.Spawner.http_timeout = 120
- c.Spawner.default_url = '/lab'
- c.JupyterHub.spawner_class = 'batchspawner.SlurmSpawner'
- c.JupyterHub.shutdown_on_logout = True
- c.BatchSpawnerBase.disable_user_config = True
- c.BatchSpawnerBase.req_nprocs = '4'
- c.BatchSpawnerBase.req_host = 'infocube.XXX.XXX.XXX'
- c.BatchSpawnerBase.req_runtime = '4:30:00'
- c.BatchSpawnerBase.req_memory = '8000'
- c.BatchSpawnerBase.req_partition = 'compute'
- c.SlurmSpawner.req_queue = 'compute'
- c.SlurmSpawner.cmd = ["/opt/jupyterhub/bin/python", "/opt/jupyterhub/bin/jupyterhub-singleuser"]
- c.SlurmSpawner.batch_script='''#!/bin/bash
- #SBATCH --time={runtime}
- #SBATCH --output=/cluster/{username}/.jupyterhub_slurmspawner.log
- #SBATCH --job-name=spawner-jupyterhub
- #SBATCH --chdir=/cluster/{username}
- #SBATCH --mem={memory}
- #SBATCH --export=PATH,LANG,JUPYTERHUB_API_TOKEN,JPY_API_TOKEN,JUPYTERHUB_CLIENT_ID,JUPYTERHUB_HOST,JUPYTERHUB_OAUTH_CALLBACK_URL,JUPYTERHUB_USER,JUPYTERHUB_SERVER_NAME,JUPYTERHUB_API_URL,JUPYTERHUB_ACTIVITY_URL,JUPYTERHUB_BASE_URL,JUPYTERHUB_SERVICE_PREFIX,USER,HOME,SHELL
- #SBATCH --get-user-env=L
- #SBATCH --partition={queue}
- #SBATCH
- set -euo pipefail
- trap 'echo SIGTERM received' TERM
- {cmd}
- echo "jupyterhub-singleuser ended gracefully"
- '''
Add Comment
Please, Sign In to add comment