Skip to content

Commit b624c9a

Browse files
authored
Merge pull request #75 from ericfranz/jupyter_tut_summary
Jupyter tut summary
2 parents 3c98b2b + 0fb292c commit b624c9a

1 file changed

Lines changed: 147 additions & 4 deletions

File tree

ondemand/README.md

Lines changed: 147 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Open OnDemand Tutorial
22

3+
- [Jupyter App Tutorial Summary](#jupyter-app-tutorial-summary)
34
- [Jupyter App Tutorial](#jupyter-app-tutorial)
45
- [Passenger App Tutorial](#passenger-app-tutorial)
56
- [XDMoD Integration Tutorial](#xdmod-integration-tutorial)
@@ -9,7 +10,149 @@
910
* [Online Documentation](https://osc.github.io/ood-documentation/master/)
1011
* [Jupyter Install Tutorial](https://osc.github.io/ood-documentation/master/app-development/tutorials-interactive-apps/add-jupyter.html)
1112

12-
## Jupyter App Tutorial
13+
## Jupyter App Tutorial Summary
14+
15+
This section provides a few snippets helpful for following along with the live tutorial.
16+
17+
Login to OnDemand as hpcadmin to https://localhost:3443
18+
19+
### Get the app working
20+
21+
1. Develop => My Sandbox Apps
22+
2. Click New App
23+
3. Click Clone Existing App: `jupyter` and `/var/git/bc_example_jupyter`
24+
25+
Fix environment: `source /usr/local/jupyter/2.1.4/bin/activate`
26+
27+
28+
### Modify the Partition field
29+
30+
form.yml changes:
31+
32+
```
33+
attributes:
34+
custom_queue:
35+
widget: "select"
36+
label: "Partition"
37+
options:
38+
- ["Compute", "compute"]
39+
- ["Debug", "debug"]
40+
form:
41+
- custom_queue
42+
# - bc_queue
43+
```
44+
45+
- `custom_queue` is used instead of `partition` because of 1.8 bug that will be fixed prior to release
46+
47+
script.yml.erb changes:
48+
49+
```yaml
50+
script:
51+
queue_name: "<%= custom_queue %>"
52+
```
53+
54+
- the constructor for the Ruby object https://osc.github.io/ood_core/0.11.4/OodCore/Job/Script.html shows all the options you can set in the script.yml above (https://www.rubydoc.info/gems/ood_core/OodCore/Job/Script typically shows the latest - but sometimes this service is unavailable)
55+
56+
### Deploy to production
57+
58+
Edit manifest:
59+
60+
```
61+
---
62+
# change the name, this is what shows up in the menu
63+
name: HPC Tutorial Jupyter
64+
# change the category just to differentiate from the system installed
65+
# deskop application
66+
category: Tutorial Apps
67+
# change the subcategory
68+
subcategory: Machine Learning
69+
role: batch_connect
70+
# change the description, this shows up when you hover over the menu item on the interactive sessions page
71+
description: |
72+
This app will launch a Jupyter Lab or Notebootk on one or more nodes.
73+
74+
```
75+
76+
Deployment steps on ondemand host via Shell:
77+
78+
sudo mv /var/www/ood/apps/sys/jupyter /var/www/ood/apps/sys/jupyter.old
79+
sudo cp -r jupyter /var/www/ood/apps/sys/jupyter
80+
81+
- app directory names with periods in them do not display in the navbar, which is why we can rename the old app to jupyter.old
82+
83+
84+
### Set the memory for the job
85+
86+
form.yml changes:
87+
88+
```
89+
attributes:
90+
memory:
91+
widget: "number_field"
92+
max: 1000
93+
min: 200
94+
step: 200
95+
value: 600
96+
label: "Memory (MB)"
97+
help: "RSS Memory"
98+
form:
99+
- memory
100+
```
101+
102+
- widget specifies the type of widget to be a number
103+
- max the maximum value, ~1 GB in this case
104+
- min the minimum value, 200 MB
105+
- step the step size when users increase or decrease the value
106+
- value the default value of 600 MB
107+
- label the for UIs label
108+
- help a help message
109+
- See https://osc.github.io/ood-documentation/master/app-development/interactive/form.html#customizing-attributes for more details about what you can set in each "attribute"
110+
111+
script.yml.erb modifications:
112+
113+
```
114+
script:
115+
native:
116+
- "--mem"
117+
- "<%= memory %>M"
118+
```
119+
120+
- script.native attributes are way for us to specify scheduler specific argument to sbatch or qsub or bsub
121+
- this lets you set arguments that OnDemand doesn't provide an abstraction for
122+
123+
### Limit number of cores
124+
125+
form.yml:
126+
127+
```yaml
128+
attributes:
129+
bc_num_slots:
130+
max: 2
131+
```
132+
133+
### Add checkbox to start JupyterLab
134+
135+
form.yml:
136+
137+
```
138+
attributes:
139+
jupyterlab_switch:
140+
widget: "check_box"
141+
label: "Use JupyterLab instead of Jupyter Notebook?"
142+
help: |
143+
JupyterLab is the next generation of Jupyter, and is completely compatible with existing Jupyter Notebooks.
144+
form:
145+
- jupyterlab_switch
146+
```
147+
148+
template script.sh:
149+
150+
```
151+
jupyter <%= context.jupyterlab_switch == "1" ? "lab" : "notebook" %> --config="${CONFIG_FILE}" <%= context.extra_jupyter_args %>
152+
```
153+
154+
155+
## Jupyter App Detailed Tutorial
13156
14157
This tutorial will be using the the `hpcadmin` credentials listed in
15158
[Accessing the Applications](../docs/applications.md).
@@ -286,7 +429,7 @@ At this point, this should be the entirety of the `script.yml.erb` and `form.yml
286429
They're given here in full if you want to copy/paste them. And remember to [save your spot](#save-your-spot)!
287430

288431
```yaml
289-
# script.erb.yml
432+
# script.yml.erb
290433
script:
291434
queue_name: "<%= custom_queue %>"
292435
```
@@ -372,7 +515,7 @@ Again, now to actually use the value we populate in the form, we need to use
372515
it in the `submit.yml.erb`. This is where `script.native` attributes come in.
373516

374517
```yaml
375-
# script.erb.yml
518+
# script.yml.erb
376519
script:
377520
native:
378521
- "--mem"
@@ -398,7 +541,7 @@ At this point, this should be the entirety of the `script.yml.erb` and `form.yml
398541
They're given here in full if you want to copy/paste them. And remember to [save your spot](#save-your-spot)!
399542

400543
```yaml
401-
# script.erb.yml
544+
# script.yml.erb
402545
---
403546
script:
404547
queue_name: "<%= custom_queue %>"

0 commit comments

Comments
 (0)