Use Apptainer Jupyter Notebooks in VSCode on Torch
This page builds on the general VSCode access instructions in 09_vscode_remote_ssh_torch. Before following this workflow, complete that setup and connect VSCode to the Torch login node.
Step 1: Install VSCode Jupyter support
After connecting VSCode to the Torch login node, open the Extensions view in the VSCode remote window and search for Jupyter.
Install or enable the Microsoft Jupyter extension in the remote SSH environment. If the extension is not already installed remotely, VSCode should show an option such as:
Install in SSH: torch
Step 2: Start a Dummy Batch Job and Connect to the Compute Node
After the Jupyter extension is installed or enabled, open a terminal in the VSCode remote session on a Torch login node.
Interactive jobs on Torch may experience intermittent issues. Some compute nodes may work as expected, while others may not. As a workaround, submit a lightweight dummy batch job and then ssh to the allocated compute node after the job is running.
For example:
sbatch -c4 -t2:00:00 --mem=4G --account=<account_name> --wrap "sleep infinity"
Replace <account_name> with the account for your project. After submitting the job, Slurm will print a job ID, for example:
Submitted batch job <job_id>
Once the job is running, identify the assigned compute node and connect to it from the VSCode terminal using SSH. Check the job status and assigned node:
squeue -u $USER
ssh csXXX
After connecting, the terminal prompt should show the compute node:
[NetID@csXXX ~]$
Step 3: Open the notebook
Open the target .ipynb notebook in VSCode.
Step 4: Select the Apptainer kernel
Use the notebook kernel picker to select the Apptainer kernel for the notebook.
If the Apptainer kernel does not appear, confirm that the kernel is installed and visible on Torch before retrying in VSCode.