-
Notifications
You must be signed in to change notification settings - Fork 0
/
submit.yml.erb
79 lines (76 loc) · 2.58 KB
/
submit.yml.erb
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
<%
pwd_cfg = "c.ServerApp.password=u\'sha1:${SALT}:${PASSWORD_SHA1}\'"
host_port_cfg = "c.ServerApp.base_url=\'/node/${HOST_CFG}/${PORT_CFG}/\'"
configmap_filename = "ondemand_config.py"
configmap_data = "c.NotebookApp.port = 8080"
utility_img = "ghcr.io/nesi/training-environment-k8s-utils:v0.1.0"
user = OodSupport::User.new
services_node = Resolv.getaddress("servicesnode")
%>
---
script:
accounting_id: "<%= account %>"
wall_time: "<%= wall_time.to_i * 3600 %>"
native:
container:
name: "ml101"
image: "ghcr.io/nesi/training-environment-jupyter-ml101-app:v0.2.5"
command: ["/bin/bash","-l","<%= staged_root %>/job_script_content.sh"]
working_dir: "<%= Etc.getpwnam(ENV['USER']).dir %>"
restart_policy: 'OnFailure'
env:
NB_UID: "<%= user.uid %>"
NB_USER: "<%= user.name %>"
NB_GID: "<%= user.group.id %>"
HOME: "<%= user.home %>"
LOG_DIR: "<%= staged_root %>"
SHELL: "/bin/bash"
port: "8080"
cpu: "<%= cpu %>"
memory: "<%= memory %>Gi"
mounts:
- type: nfs
name: home
host: <%= services_node %>
path: /srv/homes
destination_path: /home/shared
- type: host
name: nslcd-socket
host_type: Socket
path: /var/run/nslcd/socket
destination_path: /var/run/nslcd/socket
- type: host
name: nsswitch-conf
host_type: File
path: /etc/nsswitch.conf
destination_path: /etc/nsswitch.conf
configmap:
files:
- filename: "<%= configmap_filename %>"
data: |
c.ServerApp.ip = '0.0.0.0'
c.ServerApp.port = 8080
c.ServerApp.port_retries = 0
c.ServerApp.open_browser = False
c.ServerApp.allow_origin = '*'
c.ServerApp.root_dir = '<%= user.home %>/sklearn_tutorial'
c.ServerApp.disable_check_xsrf = True
mount_path: '/ood'
init_containers:
- name: "init-secret"
image: "<%= utility_img %>"
command:
- "/bin/save_passwd_as_secret"
- "user-<%= user.name %>"
- name: "add-passwd-to-cfg"
image: "<%= utility_img %>"
command:
- "/bin/bash"
- "-c"
- "source /bin/passwd_from_secret; source /bin/create_salt_and_sha1; /bin/add_line_to_configmap \\\"<%= pwd_cfg %>\\\" <%= configmap_filename %>"
- name: "add-hostport-to-cfg"
image: "<%= utility_img %>"
command:
- "/bin/bash"
- "-c"
- "source /bin/find_host_port; /bin/add_line_to_configmap \\\"<%= host_port_cfg %>\\\" <%= configmap_filename %>"