Unity
Unity
About
News
Events
Docs
Contact Us
code
search
login
Unity
Unity
About
News
Events
Docs
Contact Us
dark_mode
light_mode
code login
search

Documentation

  • Requesting An Account
  • Get Started
    • Quick Start
    • Common Terms
    • HPC Resources
    • Theory of HPC
      • Overview of threads, cores, and sockets in Slurm for HPC workflows
    • Git Guide
  • Connecting to Unity
    • SSH
    • Unity OnDemand
    • Connecting to Desktop VS Code
  • Get Help
    • Frequently Asked Questions
    • How to Ask for Help
    • Troubleshooting
  • Cluster Specifications
    • Node List
    • Partition List
      • Gypsum
    • Storage
    • Node Features (Constraints)
      • NVLink and NVSwitch
    • GPU Summary List
  • Managing Files
    • Command Line Interface (CLI)
    • Disk Quotas
    • FileZilla
    • Globus
    • Scratch: HPC Workspace
    • Unity OnDemand File Browser
  • Submitting Jobs
    • Batch Jobs
      • Array Batch Jobs
      • Large Job Counts
      • Monitor a batch job
    • Helper Scripts
    • Interactive CLI Jobs
    • Unity OnDemand
    • Message Passing Interface (MPI)
    • Slurm cheat sheet
  • Software Management
    • Building Software from Scratch
    • Conda
    • Modules
      • Module Usage
    • Renv
    • Unity OnDemand
      • JupyterLab OnDemand
    • Venv
  • Tools & Software
    • ColabFold
    • R
      • R Parallelization
    • Unity GPUs
  • Datasets
    • AI and ML
      • AlpacaFarm
      • audioset
      • bigcode
      • biomed_clip
      • blip_2
      • blip_2
      • coco
      • Code Llama
      • DeepAccident
      • DeepSeek
      • DINO v2
      • epic-kitchens
      • florence
      • gemma
      • glm
      • gpt
      • gte-Qwen2
      • ibm-granite
      • Idefics2
      • Imagenet 1K
      • inaturalist
      • infly
      • instruct-blip
      • internLM
      • intfloat
      • LAION
      • lg
      • linq
      • llama
      • Llama2
      • llama3
      • llama4
      • Llava_OneVision
      • Lumina
      • mixtral
      • msmarco
      • natural-questions
      • objaverse
      • openai-whisper
      • phi
      • playgroundai
      • pythia
      • qwen
      • R1-1776
      • rag-sequence-nq
      • red-pajama-v2
      • s1-32B
      • satlas_pretrain
      • scalabilityai
      • sft
      • SlimPajama
      • t5
      • Tulu
      • V2X
      • video-MAE
      • videoMAE-v2
      • vit
      • wildchat
    • Bioinformatics
      • AlphaFold3 Databases
      • BFD/MGnify
      • Big Fantastic Database
      • checkm
      • ColabFoldDB
      • dfam
      • EggNOG
      • EggNOG
      • gmap
      • GMAP-GSNAP database (human genome)
      • GTDB
      • igenomes
      • Kraken2
      • MGnify
      • NCBI BLAST databases
      • NCBI RefSeq database
      • NCBI RefSeq database
      • Parameters of Evolutionary Scale Modeling (ESM) models
      • params
      • PDB70
      • PDB70 for ColabFold
      • PINDER
      • PLINDER
      • Protein Data Bank
      • Protein Data Bank database in mmCIF format
      • Protein Data Bank database in SEQRES records
      • Tara Oceans 18S amplicon
      • Tara Oceans MATOU gene catalog
      • Tara Oceans MGT transcriptomes
      • Uniclust30
      • UniProtKB
      • UniRef100
      • UniRef30
      • UniRef90
      • Updated databases for ColabFold
    • Using HuggingFace Datasets

Documentation

  • Requesting An Account
  • Get Started
    • Quick Start
    • Common Terms
    • HPC Resources
    • Theory of HPC
      • Overview of threads, cores, and sockets in Slurm for HPC workflows
    • Git Guide
  • Connecting to Unity
    • SSH
    • Unity OnDemand
    • Connecting to Desktop VS Code
  • Get Help
    • Frequently Asked Questions
    • How to Ask for Help
    • Troubleshooting
  • Cluster Specifications
    • Node List
    • Partition List
      • Gypsum
    • Storage
    • Node Features (Constraints)
      • NVLink and NVSwitch
    • GPU Summary List
  • Managing Files
    • Command Line Interface (CLI)
    • Disk Quotas
    • FileZilla
    • Globus
    • Scratch: HPC Workspace
    • Unity OnDemand File Browser
  • Submitting Jobs
    • Batch Jobs
      • Array Batch Jobs
      • Large Job Counts
      • Monitor a batch job
    • Helper Scripts
    • Interactive CLI Jobs
    • Unity OnDemand
    • Message Passing Interface (MPI)
    • Slurm cheat sheet
  • Software Management
    • Building Software from Scratch
    • Conda
    • Modules
      • Module Usage
    • Renv
    • Unity OnDemand
      • JupyterLab OnDemand
    • Venv
  • Tools & Software
    • ColabFold
    • R
      • R Parallelization
    • Unity GPUs
  • Datasets
    • AI and ML
      • AlpacaFarm
      • audioset
      • bigcode
      • biomed_clip
      • blip_2
      • blip_2
      • coco
      • Code Llama
      • DeepAccident
      • DeepSeek
      • DINO v2
      • epic-kitchens
      • florence
      • gemma
      • glm
      • gpt
      • gte-Qwen2
      • ibm-granite
      • Idefics2
      • Imagenet 1K
      • inaturalist
      • infly
      • instruct-blip
      • internLM
      • intfloat
      • LAION
      • lg
      • linq
      • llama
      • Llama2
      • llama3
      • llama4
      • Llava_OneVision
      • Lumina
      • mixtral
      • msmarco
      • natural-questions
      • objaverse
      • openai-whisper
      • phi
      • playgroundai
      • pythia
      • qwen
      • R1-1776
      • rag-sequence-nq
      • red-pajama-v2
      • s1-32B
      • satlas_pretrain
      • scalabilityai
      • sft
      • SlimPajama
      • t5
      • Tulu
      • V2X
      • video-MAE
      • videoMAE-v2
      • vit
      • wildchat
    • Bioinformatics
      • AlphaFold3 Databases
      • BFD/MGnify
      • Big Fantastic Database
      • checkm
      • ColabFoldDB
      • dfam
      • EggNOG
      • EggNOG
      • gmap
      • GMAP-GSNAP database (human genome)
      • GTDB
      • igenomes
      • Kraken2
      • MGnify
      • NCBI BLAST databases
      • NCBI RefSeq database
      • NCBI RefSeq database
      • Parameters of Evolutionary Scale Modeling (ESM) models
      • params
      • PDB70
      • PDB70 for ColabFold
      • PINDER
      • PLINDER
      • Protein Data Bank
      • Protein Data Bank database in mmCIF format
      • Protein Data Bank database in SEQRES records
      • Tara Oceans 18S amplicon
      • Tara Oceans MATOU gene catalog
      • Tara Oceans MGT transcriptomes
      • Uniclust30
      • UniProtKB
      • UniRef100
      • UniRef30
      • UniRef90
      • Updated databases for ColabFold
    • Using HuggingFace Datasets

On this page

  • Access and set up JupyterHub
  • Run a Jupyter notebook non-interactively
    • Non-interactively run a job using nbconvert
    • Non-interactively run a job using papermill
  1. Unity
  2. Documentation
  3. Software Management
  4. Unity OnDemand
  5. JupyterLab OnDemand

How to use JupyterLab on Unity OnDemand

Unity OnDemand provides JupyterLab as a way to manage your software in Unity. JupyterLab is a web-based interactive computational environment for creating your Jupyter notebooks, code, and data.

The following sections will guide you through how to access and set up JupyterLab, and how to run a job non-interactively to avoid disconnection issues.

Access and set up JupyterHub

The following steps will guide you through how to access and set up JupyterLab through Unity OnDemand.

  1. Go to Unity OnDemand and sign in.

  2. From the top menu, click Interactive Apps.

  3. In the dropdown menu that appears, click JupyterLab.

  4. On the JupyterLab page, fill in the following fields:

    • Partition: the type of compute nodes you want to run your interactive session on. For more information on partitions, see the partition list.
    • Maximum job duration: how long the interactive session with JupyterLab runs for in the format Hours:Minutes:Seconds (e.g., 1:00:00 for one hour). Interactive sessions are limited to 8 hours (8:00:00). For information on running a Jupyter Notebook non-interactively, see the section below.
    • Memory (in GB): the amount of memory, in gigabytes, allocated to your interactive session.
    • GPU count: the number of GPUs allocated to your interactive session. You must specify a GPU-enabled partition in the partition field to use a GPU.
    • Modules: which Lmod environment modules should be loaded before the job starts.
      warning
      You should not specify Python packages here. Instead, if you need an environment with specific Python packages, create a conda environment or virtual environment and install the kernel.
    • Short QOS checkbox: For jobs shorter than four hours, you can use the “short” QOS to boost priority for a single job.
    • Extra arguments for Slurm: generally, this can be left blank. However, you can use any sbatch options here to customize job submission.

Run a Jupyter notebook non-interactively

When using JupyterLab through Unity OnDemand, it’s possible that your computer could get disconnected from the internet, causing the kernel to be interrupted. In addition, interactive sessions are limited to eight hours. One way to avoid this is to use nbconvert to run your job non-interactively. Alternatively, you can use the Python package papermill, which has more features available.

The following sections will guide you through the nbconvert and papermill methods, both of which should take place in an sbatch file. For a guide on sbatch, see Introduction to batch jobs.

Non-interactively run a job using nbconvert

  1. To non-interactively run a job with nbconvert, open your sbatch file and load the miniconda module using the following command:

    module load conda/latest
    
  2. Activate the conda environment using the following command:

    conda activate jupyterhub-stable
    
stylus_note

If you are using a different conda environment, ensure that nbconvert is available. If not, you can install nbconvert with

conda install nbconvert # For conda environments
pip install nbconvert # For venvs
  1. To execute the the code cells in your notebook and save them back to the same Jupyter Notebook format, use the --nbconvert, as shown in the following example:
jupyter nbconvert --to notebook --execute YOUR_NOTEBOOK.ipynb

The new output of the job is created at a new file, called YOUR_NOTEBOOK.nbconvert.ipynb.

To rewrite the existing file and save the output to it, add the --inplace flag, as shown in the following example:

jupyter nbconvert --to notebook --execute --inplace YOUR_NOTEBOOK.ipynb

Non-interactively run a job using papermill

Alternatively, you can use Papermill to parameterize and execute your Jupyter Notebooks. Papermill has more features than are available with nbconvert.

The following steps will guide you through how to install papermill and parameterize your Jupyter Notebook to support running non-interactively.

  1. In your conda environment or venv, install Papermill using the following command:
conda install -c conda-forge papermill # for Conda environments
pip install papermill # For venvs
  1. In your notebook (from the Unity OnDemand JupyerLab interface), select the cell that you want to parameterize.

  2. From the left menu of JupyterLab, click the double gear icon.

  3. Type “parameters” in the Add Tag field and click Enter.

  4. In your sbatch file, execute the notebook using the following command:

    papermill YOUR_CODE_INPUT.ipynb YOUR_CODE_OUTPUT.ipynb --autosave-cell-every 20
    

    To save the output code to the same file rather than creating a new one, replace YOUR_CODE_OUTPUT.ipynb with YOUR_CODE_INPUT.ipynb, as shown in the following example:

    papermill YOUR_CODE_INPUT.ipynb YOUR_CODE_INPUT.ipynb --autosave-cell-every 20
    
stylus_note
If you need to skip a cell, add %%script echo skipping to the top line of the cell.
Last modified: Friday, March 14, 2025 at 2:20 PM. See the commit on GitLab.
University of Massachusetts Amherst University of Massachusetts Amherst University of Rhode Island University of Rhode Island University of Massachusetts Dartmouth University of Massachusetts Dartmouth University of Massachusetts Lowell University of Massachusetts Lowell University of Massachusetts Boston University of Massachusetts Boston Mount Holyoke College Mount Holyoke College Smith College Smith College
search
close