Skip to content

Commit f852837

Browse files
committed
In the VM-mode brev script, create the Jupyter service ourselves and bring it up.
1 parent 95f964f commit f852837

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

build/brev-script.bash

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,25 @@ source ~/pyhpc-tutorial/.venv/bin/activate
2121
# Install Python packages
2222
uv pip install -r ~/pyhpc-tutorial/build/requirements.txt
2323

24-
# TODO: Change Jupyter config to set the right working directory, install Nsight Jupyter plugin, and restart Jupyter
24+
# Create a Jupyter service
25+
cat >/etc/systemd/system/jupyterlab.service <<'EOF'
26+
[Unit]
27+
Description=JupyterLab
28+
After=network-online.target
29+
Wants=network-online.target
30+
31+
[Service]
32+
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=""'
37+
Restart=on-failure
38+
RestartSec=5
39+
40+
[Install]
41+
WantedBy=multi-user.target
42+
EOF
43+
44+
systemctl daemon-reload
45+
systemctl enable --now jupyterlab.service

0 commit comments

Comments
 (0)