|
1 | | -import socket |
2 | 1 | import os |
| 2 | +import socket |
| 3 | + |
3 | 4 | c = get_config() # noqa |
4 | 5 |
|
5 | 6 | from jupyterhub.auth import DummyAuthenticator |
|
10 | 11 | # c.DummyAuthenticator.password = "your_password" |
11 | 12 |
|
12 | 13 | from kubespawner.spawner import KubeSpawner |
| 14 | + |
13 | 15 | c.JupyterHub.spawner_class = KubeSpawner |
14 | 16 |
|
15 | 17 | c.Spawner.cmd = ["jupyterhub-singleuser"] |
|
18 | 20 | # the hub to be able to restart without losing user containers |
19 | 21 | c.JupyterHub.cleanup_servers = False |
20 | 22 | c.JupyterHub.services = [ |
21 | | - { |
22 | | - "name": "binder", |
23 | | - "url": "http://localhost:8585", |
24 | | - "command": ["python", "-m", "binderhub", "-f", "binderhub_config.py"], |
25 | | - # Pass on environment variables required for binderhub to find where the docker image is |
26 | | - "environment": os.environ.copy() |
27 | | - } |
| 23 | + { |
| 24 | + "name": "binder", |
| 25 | + "url": "http://localhost:8585", |
| 26 | + "command": ["python", "-m", "binderhub", "-f", "binderhub_config.py"], |
| 27 | + # Pass on environment variables required for binderhub to find where the docker image is |
| 28 | + "environment": os.environ.copy(), |
| 29 | + } |
28 | 30 | ] |
29 | 31 |
|
30 | 32 | # Find the IP of the machine that minikube is most likely able to talk to |
|
37 | 39 | c.JupyterHub.hub_connect_ip = host_ip |
38 | 40 |
|
39 | 41 | from jupyterhub_fancy_profiles import setup_ui |
| 42 | + |
40 | 43 | setup_ui(c) |
41 | 44 |
|
42 | 45 | c.KubeSpawner.profile_list = [ |
43 | | - { |
44 | | - "display_name": "Small", |
45 | | - "description": "~2 CPU, ~2G RAM", |
46 | | - "profile_options": { |
47 | | - "image": { |
48 | | - "display_name": "Image", |
49 | | - "unlisted_choice": { |
50 | | - "enabled": True, |
51 | | - "display_name": "Custom image", |
52 | | - "validation_regex": "^.+:.+$", |
53 | | - "validation_message": "Must be a publicly available docker image, of form <image-name>:<tag>", |
54 | | - "display_name_in_choices": "Specify an existing docker image", |
55 | | - "description_in_choices": "Use a pre-existing docker image from a public docker registry (dockerhub, quay, etc)", |
56 | | - "kubespawner_override": { |
57 | | - "image": "{value}" |
58 | | - } |
59 | | - }, |
60 | | - "choices": { |
61 | | - "pangeo": { |
62 | | - "display_name": "Pangeo Notebook Image", "description": "Python image with scientific, dask and geospatial tools", |
63 | | - "kubespawner_override": { |
64 | | - "image": "pangeo/pangeo-notebook:2023.09.11" |
65 | | - } |
66 | | - }, |
67 | | - "geospatial": { |
68 | | - "display_name": "Rocker Geospatial", |
69 | | - "description": "R image with RStudio, the tidyverse & Geospatial tools", |
70 | | - "default": True, |
71 | | - "slug": "geospatial", |
72 | | - "kubespawner_override": { |
73 | | - "image": "rocker/binder:4.3", |
74 | | - "default_url": "/rstudio", |
75 | | - "working_dir": "/home/rstudio", |
76 | | - } |
77 | | - }, |
78 | | - "scipy": { |
79 | | - "display_name": "Jupyter SciPy Notebook", |
80 | | - "slug": "scipy", |
81 | | - "kubespawner_override": { |
82 | | - "image": "jupyter/scipy-notebook:2023-06-26" |
83 | | - } |
84 | | - } |
85 | | - } |
86 | | - }, |
87 | | - "resources": { |
88 | | - "display_name": "Resource Allocation", |
89 | | - "choices": { |
90 | | - "mem_2_7": { |
91 | | - "display_name": "2.7 GB RAM, upto 3.479 CPUs", |
92 | | - "description": "Use this for the workshop on 2023 September", |
93 | | - "kubespawner_override": { |
94 | | - "mem_guarantee": 1024, |
95 | | - "mem_limit": 2904451072, |
96 | | - "cpu_guarantee": 0.1, |
97 | | - "cpu_limit": 3.479, |
| 46 | + { |
| 47 | + "display_name": "Small", |
| 48 | + "description": "~2 CPU, ~2G RAM", |
| 49 | + "profile_options": { |
| 50 | + "image": { |
| 51 | + "display_name": "Image", |
| 52 | + "unlisted_choice": { |
| 53 | + "enabled": True, |
| 54 | + "display_name": "Custom image", |
| 55 | + "validation_regex": "^.+:.+$", |
| 56 | + "validation_message": "Must be a publicly available docker image, of form <image-name>:<tag>", |
| 57 | + "display_name_in_choices": "Specify an existing docker image", |
| 58 | + "description_in_choices": "Use a pre-existing docker image from a public docker registry (dockerhub, quay, etc)", |
| 59 | + "kubespawner_override": {"image": "{value}"}, |
| 60 | + }, |
| 61 | + "choices": { |
| 62 | + "pangeo": { |
| 63 | + "display_name": "Pangeo Notebook Image", |
| 64 | + "description": "Python image with scientific, dask and geospatial tools", |
| 65 | + "kubespawner_override": { |
| 66 | + "image": "pangeo/pangeo-notebook:2023.09.11" |
| 67 | + }, |
| 68 | + }, |
| 69 | + "geospatial": { |
| 70 | + "display_name": "Rocker Geospatial", |
| 71 | + "description": "R image with RStudio, the tidyverse & Geospatial tools", |
| 72 | + "default": True, |
| 73 | + "slug": "geospatial", |
| 74 | + "kubespawner_override": { |
| 75 | + "image": "rocker/binder:4.3", |
| 76 | + "default_url": "/rstudio", |
| 77 | + "working_dir": "/home/rstudio", |
| 78 | + }, |
| 79 | + }, |
| 80 | + "scipy": { |
| 81 | + "display_name": "Jupyter SciPy Notebook", |
| 82 | + "slug": "scipy", |
| 83 | + "kubespawner_override": { |
| 84 | + "image": "jupyter/scipy-notebook:2023-06-26" |
| 85 | + }, |
| 86 | + }, |
| 87 | + }, |
98 | 88 | }, |
99 | | - "default": True |
100 | | - }, |
101 | | - "mem_5_4": { |
102 | | - "display_name": "5.4 GB RAM, upto 3.479 CPUs", |
103 | | - "kubespawner_override": { |
104 | | - "mem_guarantee":1024, |
105 | | - "mem_limit": 5808902144, |
106 | | - "cpu_guarantee": 0.1, |
107 | | - "cpu_limit": 3.479, |
108 | | - } |
109 | | - }, |
110 | | - "mem_10_8": { |
111 | | - "display_name": "10.8 GB RAM, upto 3.479 CPUs", |
112 | | - "kubespawner_override": { |
113 | | - "mem_guarantee": 1024, |
114 | | - "mem_limit": 11617804288, |
115 | | - "cpu_guarantee": 0.1, |
116 | | - "cpu_limit": 3.479, |
117 | | - } |
118 | | - }, |
119 | | - "mem_21_6": { |
120 | | - "display_name": "21.6 GB RAM, upto 3.479 CPUs", |
121 | | - "description": "Large amount of RAM, might start slowly", |
122 | | - "kubespawner_override": { |
123 | | - "mem_guarantee": 1024, |
124 | | - "mem_limit": 23235608576, |
125 | | - "cpu_guarantee": 0.1, |
126 | | - "cpu_limit": 3.479 |
| 89 | + "resources": { |
| 90 | + "display_name": "Resource Allocation", |
| 91 | + "choices": { |
| 92 | + "mem_2_7": { |
| 93 | + "display_name": "2.7 GB RAM, upto 3.479 CPUs", |
| 94 | + "description": "Use this for the workshop on 2023 September", |
| 95 | + "kubespawner_override": { |
| 96 | + "mem_guarantee": 1024, |
| 97 | + "mem_limit": 2904451072, |
| 98 | + "cpu_guarantee": 0.1, |
| 99 | + "cpu_limit": 3.479, |
| 100 | + }, |
| 101 | + "default": True, |
| 102 | + }, |
| 103 | + "mem_5_4": { |
| 104 | + "display_name": "5.4 GB RAM, upto 3.479 CPUs", |
| 105 | + "kubespawner_override": { |
| 106 | + "mem_guarantee": 1024, |
| 107 | + "mem_limit": 5808902144, |
| 108 | + "cpu_guarantee": 0.1, |
| 109 | + "cpu_limit": 3.479, |
| 110 | + }, |
| 111 | + }, |
| 112 | + "mem_10_8": { |
| 113 | + "display_name": "10.8 GB RAM, upto 3.479 CPUs", |
| 114 | + "kubespawner_override": { |
| 115 | + "mem_guarantee": 1024, |
| 116 | + "mem_limit": 11617804288, |
| 117 | + "cpu_guarantee": 0.1, |
| 118 | + "cpu_limit": 3.479, |
| 119 | + }, |
| 120 | + }, |
| 121 | + "mem_21_6": { |
| 122 | + "display_name": "21.6 GB RAM, upto 3.479 CPUs", |
| 123 | + "description": "Large amount of RAM, might start slowly", |
| 124 | + "kubespawner_override": { |
| 125 | + "mem_guarantee": 1024, |
| 126 | + "mem_limit": 23235608576, |
| 127 | + "cpu_guarantee": 0.1, |
| 128 | + "cpu_limit": 3.479, |
| 129 | + }, |
| 130 | + }, |
| 131 | + }, |
127 | 132 | }, |
128 | | - } |
129 | | - } |
130 | | - } |
| 133 | + }, |
131 | 134 | } |
132 | | - } |
133 | 135 | ] |
0 commit comments