diff --git a/jupyterhub_config.py b/jupyterhub_config.py index 9cbf55b..9982eb9 100644 --- a/jupyterhub_config.py +++ b/jupyterhub_config.py @@ -21,5 +21,7 @@ c.UCRSpawner.max_disk = 5000 c.UCRSpawner.gpu = 0 c.UCRSpawner.max_gpu = 0 +c.UCRSpawner.user_port = 0 +c.UCRSpawner.max_user_port = 2 c.UCRSpawner.mesos_user = os.environ['MESOS_USER'] c.UCRSpawner.debug = True diff --git a/ucrspawner/ucrspawner.py b/ucrspawner/ucrspawner.py index df42d52..115d0f9 100644 --- a/ucrspawner/ucrspawner.py +++ b/ucrspawner/ucrspawner.py @@ -101,6 +101,9 @@ class UCRSpawner(Spawner): max_gpu = Integer(0, config=True) gpu = Integer(0, config=True) + max_user_port = Integer(2, config=True) + user_port = Integer(0, config=True) + mesos_user = Unicode(None, config=True, allow_none=True) hub_ip_connect = Unicode( @@ -256,7 +259,7 @@ def get_args(self): if arg.startswith('--port='): args.pop(idx) break - args.append('--port=$PORT0') + args.append('--port=$PORT_NOTEBOOK') return args def options_from_form(self, formdata): @@ -268,6 +271,7 @@ def options_from_form(self, formdata): options['mem'] = float(formdata['mem'][0]) options['disk'] = float(formdata['disk'][0]) options['gpu'] = int(formdata['gpu'][0]) + options['user_port'] = int(formdata['user_port'][0]) return options @property @@ -310,6 +314,11 @@ def options_form(self): +