Skip to content

Commit baa1ed0

Browse files
authored
Allow for choice of notebook root (#129)
* Add notebook root selection * Update manifest with correct cluster and changelog information * Fixed the issue of no $HOME default * A safeguard to prevent the selection of a non-existent or unreadable directory
1 parent 85f1d94 commit baa1ed0

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

form.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ cluster:
99
form:
1010
- auto_accounts
1111
- mode
12+
- working_dir
1213
- bc_num_hours
1314
- node_type
1415
- gpus
@@ -68,6 +69,12 @@ attributes:
6869
options:
6970
- ["Jupyter Lab", "1"]
7071
- ["Jupyter Notebook", "0"]
72+
working_dir:
73+
widget: "path_selector"
74+
label: "Root Directory"
75+
data-target-file-type: dirs # Valid values are: files, dirs, or both
76+
readonly: false
77+
help: "Select your project directory; defaults to $HOME"
7178
num_cores:
7279
widget: "number_field"
7380
label: "Number of cores"

manifest.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ category: Interactive Apps
44
subcategory: Servers
55
role: batch_connect
66
description: |
7-
This app will launch a [Jupyter] server using [Python] on the [Ascend], [Owens] or
8-
[Pitzer] clusters.
7+
Launch a [Jupyter] server with [Python] on [Cardinal], [Ascend], or [Pitzer].
8+
Check the [Changelog] for the recent updates.
99
1010
[Jupyter]: https://jupyter.org/
1111
[Python]: https://www.python.org/
12-
[Owens]: https://www.osc.edu/resources/technical_support/supercomputers/owens
12+
[Cardinal]: https://www.osc.edu/resources/technical_support/supercomputers/cardinal
13+
[Ascend]: https://www.osc.edu/resources/technical_support/supercomputers/ascend
1314
[Pitzer]: https://www.osc.edu/resources/technical_support/supercomputers/pitzer
14-
[Ascend]: https://www.osc.edu/vocabulary/systems/ascend
15+
[Changelog]: https://www.osc.edu/resources/technical_support/hpc_changelog?keys=jupyter

template/before.sh.erb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ source /bin/find_host_port
88
source /bin/save_passwd_as_secret
99
source /bin/create_salt_and_sha1
1010
<% else -%>
11+
1112
[[ $(type -t module) == "function" ]] && export -f module
1213

1314
# Find available port to run server on
@@ -49,7 +50,13 @@ export JUPYTERLAB_WORKSPACES_DIR=$PWD
4950
export jupyter_api="$JUPYTER_API"
5051

5152
# Notebook root directory
52-
export NOTEBOOK_ROOT="${NOTEBOOK_ROOT:-${HOME}}"
53+
working_dir="<%= Pathname.new(context.working_dir) %>"
54+
USER_SELECT_ROOT="${working_dir:-$HOME}"
55+
if [[ -r "$USER_SELECT_ROOT" ]]; then
56+
export NOTEBOOK_ROOT="$USER_SELECT_ROOT"
57+
else
58+
export NOTEBOOK_ROOT="$HOME"
59+
fi
5360

5461
# Generate Jupyter configuration file with secure file permissions
5562
(

0 commit comments

Comments
 (0)