Skip to content

Commit 51bb4ae

Browse files
committed
Make sure Jupyter configuration directories are created and add symlinking code to Brev script.
1 parent d23c26f commit 51bb4ae

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

build/brev-script.bash

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,30 @@ source ~/pyhpc-tutorial/.venv/bin/activate
2121
# Install Python packages
2222
uv pip install -r ~/pyhpc-tutorial/build/requirements.txt
2323

24-
# Create a Jupyter service
25-
cat >jupyterlab.service <<'EOF'
24+
# Create the Jupyter service
25+
cat >jupyterlab.service <<EOF
2626
[Unit]
2727
Description=JupyterLab
2828
After=network-online.target
2929
Wants=network-online.target
3030
3131
[Service]
3232
Type=simple
33-
User=ubuntu
34-
WorkingDirectory=/home/ubuntu/pyhpc-tutorial
35-
Environment=HOME=/home/ubuntu
36-
ExecStart=/bin/bash -lc 'source /home/ubuntu/pyhpc-tutorial/.venv/bin/activate; exec python -m jupyter lab --allow-root --ip=0.0.0.0 --no-browser --NotebookApp.token="" --NotebookApp.password="" --NotebookApp.default_url=""'
33+
User=$(whoami)
34+
WorkingDirectory=/home/$(whoami)/pyhpc-tutorial
35+
Environment=HOME=/home/$(whoami)
36+
ExecStart=/bin/bash -lc 'source /home/$(whoami)/pyhpc-tutorial/.venv/bin/activate; exec python -m jupyter lab --allow-root --ip=0.0.0.0 --no-browser --NotebookApp.token="" --NotebookApp.password="" --NotebookApp.default_url=""'
3737
Restart=on-failure
3838
RestartSec=5
3939
4040
[Install]
4141
WantedBy=multi-user.target
4242
EOF
4343

44+
mkdir -p ~/.jupyter/lab/user-settings/jupyterlab-nvidia-nsight
45+
ln -fs ~/pyhpc-tutorial/build/jupyter_server_config.py ~/.jupyter/jupyter_server_config.py
46+
ln -fs ~/pyhpc-tutorial/build/jupyter_nsight_plugin_settings.json ~/.jupyter/lab/user-settings/jupyterlab-nvidia-nsight/plugin.jupyterlab-settings
47+
4448
sudo mv jupyterlab.service /etc/systemd/system/jupyterlab.service
4549
sudo systemctl daemon-reload
4650
sudo systemctl enable --now jupyterlab.service

build/dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ WORKDIR /pyhpc-tutorial/notebooks
77
RUN pip install --root-user-action ignore -r /pyhpc-tutorial/build/requirements.txt \
88
&& git config --unset-all "http.https://github.com/.extraheader" || { code=$?; [ "$code" = 5 ] || exit "$code"; } \
99
&& git config --global --add safe.directory "/pyhpc-tutorial" \
10-
&& mkdir ~/.jupyter \
10+
&& mkdir -p ~/.jupyter/lab/user-settings/jupyterlab-nvidia-nsight \
1111
&& mkdir -p ~/.local/state/._bash_history \
1212
&& ln -fs /pyhpc-tutorial/build/jupyter_server_config.py ~/.jupyter/jupyter_server_config.py \
1313
&& ln -fs /pyhpc-tutorial/build/jupyter_nsight_plugin_settings.json ~/.jupyter/lab/user-settings/jupyterlab-nvidia-nsight/plugin.jupyterlab-settings

0 commit comments

Comments
 (0)