-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfig.yaml.bk
161 lines (150 loc) · 4.36 KB
/
config.yaml.bk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
proxy:
secretToken: ""
service:
type: NodePort
nodePorts:
http: 30080
https: 30443
cull:
timeout: 86400
hub:
#Clone custom JupyterHub templates into a volume
initContainers:
- name: git-clone-templates
image: alpine/git
args:
- clone
- --single-branch
- --branch=master
- --depth=1
- --
- https://github.com/L1NNA/L1NNA-peppapig
- /etc/jupyterhub/custom
securityContext:
runAsUser: 0
volumeMounts:
- name: custom-templates
mountPath: /etc/jupyterhub/custom
extraVolumes:
- name: custom-templates
emptyDir: {}
extraVolumeMounts:
- name: custom-templates
mountPath: /etc/jupyterhub/custom
extraConfig:
templates: |
c.JupyterHub.default_url = 'landing'
c.JupyterHub.template_paths = ['/etc/jupyterhub/custom/hub_templates_bt4/']
landing: |
from jupyterhub.handlers.base import BaseHandler
class LandingHandler(BaseHandler):
def get(self):
content = self.render_template(
'login.html',
authenticator_login_url="https://p.l1nna.com/hub/oauth_login?next="
)
self.finish(content)
c.JupyterHub.extra_handlers = [
(
r'/landing',
LandingHandler
),
]
debug: |
# Set the log level by value or name.
c.JupyterHub.log_level = 'DEBUG'
# Enable debug-logging of the single-user server
c.Spawner.debug = True
# Enable debug-logging of the single-user server
c.LocalProcessSpawner.debug = True
options_form: |
async def dynamic_form(self):
import urllib.request
import yaml
import os
data = urllib.request.urlopen('https://raw.githubusercontent.com/L1NNA/L1NNA-peppapig/master/runtime_setting.yaml').read().decode('utf-8')
data = yaml.safe_load(data)
self.log.info(str(data))
username = self.user.name.strip()
self.log.info(username)
ss = 'sm'
ds = '200G SSD SSDSC2KB019T8R'
if username in data['storage']['md']:
ss = 'md'
ds = '500G SSD SSDSC2KB019T8R'
if username in data['storage']['lg']:
ss = 'lg'
ds = '1024G SSD SSDSC2KB019T8R'
return data['from_data'].format(ss, ds)
c.KubeSpawner.options_form = dynamic_form
pre_spawn_hook: |
async def my_pre_spawn_hook(spawner):
auth_state = await spawner.user.get_auth_state()
spawner.log.info(' haha ' + str(auth_state))
spawner.log.info(' haha ' + str(spawner.user_options))
options = spawner.user_options
spawner.image = options['image'][0]
spawner.cpu_limit = float(options['cpu_limit'][0])
spawner.mem_limit = options['mem_limit'][0]
spawner.storage_class = options['storage_class'][0]
spawner.extra_resource_limits = {"nvidia.com/gpu": int(options["gpu_limit"][0])}
c.KubeSpawner.pre_spawn_hook = my_pre_spawn_hook
auth:
type: github
admin:
access: true
users:
- "steven-hh-ding"
- "haz"
- "WiegerTheFarmer"
github:
clientId: ""
clientSecret: ""
callbackUrl: "https://p.l1nna.com/hub/oauth_callback"
orgWhitelist:
- "qumulab"
- "L1NNA"
scopes:
- "read:user"
- "read:org"
singleuser:
lifecycleHooks:
postStart:
exec:
command:
- "sh"
- "-c"
- >
curl https://raw.githubusercontent.com/L1NNA/L1NNA-peppapig/master/setup_desktop.sh | bash
image:
name: l1nna/peppapig
tag: tf2.3-torch1.4-v0.0.5
defaultUrl: "/lab"
extraEnv:
GRANT_SUDO: "yes"
NOTEBOOK_ARGS: "--allow-root"
SLACK_WEBHOOK_URL: "peppa-webhook"
uid: 0
cmd: start-singleuser.sh
storage:
dynamic:
storageClass: local-hdd-sm
extraVolumes:
- name: shared-data
persistentVolumeClaim:
claimName: "shared-data"
namespace: "jhub"
- name: shared-data-gw
persistentVolumeClaim:
claimName: "shared-data-gw"
namespace: "jhub"
- name: shm-volume
emptyDir:
medium: Memory
extraVolumeMounts:
- name: shared-data
mountPath: "/home/projects"
- name: shared-data-gw
mountPath: "/home/datasets"
- name: shm-volume
mountPath: /dev/shm