Skip to content

Interactive Workload

Docs

This guide walks you through creating and connecting to a Jupyter Notebook workspace in Run:AI. Interactive workloads are perfect for development, data exploration, and experimentation.

Prerequisites

Before starting, ensure you have: - Access to the Run:AI user interface - A project with at least 1 GPU quota assigned - Basic familiarity with Jupyter notebooks

Step-by-Step Guide

1. Access the Run:AI Interface

Log in to your Run:AI user interface through your web browser.

2. Create a New Workspace

  1. Navigate to Workload manager → Workloads
  2. Click "+NEW WORKLOAD"
  3. Select "Workspace" from the workload types

3. Configure Basic Settings

  1. Select Cluster and Project: Choose your target cluster and the project you want to use
  2. Template Selection: Choose "Start from Scratch" for full control
  3. Workload Name: Enter a unique, descriptive name for your workspace
# Example naming convention
jupyter-exploration-2024
data-analysis-workspace
ml-experiments-v1

4. Environment Configuration

  1. Environment: Select "jupyter-lab" from the available environments
  2. This uses the jupyter/scipy-notebook image
  3. Includes common data science libraries pre-installed
  4. Container Configuration: The system will automatically configure:
  5. Base URL settings
  6. Authentication token
  7. Port mapping

5. Compute Resources

  1. GPU Allocation: Select "one-gpu" compute resource
  2. This allocates one full GPU to your workspace
  3. You can also choose fractional GPU options if available
  4. CPU and Memory: Default allocations are typically sufficient for most Jupyter workloads

6. Data Sources (Optional)

If you have data sources configured: 1. PVC Data Sources: Mount any persistent volume claims 2. Git Repositories: Clone datasets or code repositories 3. Object Storage: Connect to S3-compatible storage

Example mount paths:

/mnt/datasets     # For datasets
/mnt/code         # For code repositories  
/mnt/scratch      # For temporary files

7. Submit the Workspace

  1. Review your configuration
  2. Click "CREATE WORKLOAD"
  3. Monitor the deployment in the workload manager

8. Connect to Jupyter

Once the workspace is running:

  1. Locate Your Workspace: Find it in the workload manager list
  2. Click "CONNECT": This opens connection options
  3. Select "Jupyter": Choose the Jupyter tool from available options
  4. Access Notebook: Jupyter will open in a new browser tab

9. Verify Your Setup

Once connected to Jupyter:

# Test GPU availability
import torch
print(f"CUDA available: {torch.cuda.is_available()}")
print(f"GPU count: {torch.cuda.device_count()}")
print(f"Current device: {torch.cuda.current_device()}")
# Check mounted data sources
import os
print("Mounted directories:")
for item in os.listdir("/mnt"):
    print(f"  - /mnt/{item}")

Method 2: Using the CLI

1. Submit Interactive Workspace

# Basic Jupyter workspace
runai submit "my-jupyter-workspace" \
    --image jupyter/scipy-notebook \
    --gpu 1 \
    --interactive \
    --port 8888:8888 \
    --volume /data:/workspace/data

# Advanced configuration with specific resources
runai submit "advanced-workspace" \
    --image jupyter/tensorflow-notebook \
    --gpu-portion-request 0.5 \
    --cpu 4 \
    --memory 8Gi \
    --interactive \
    --port 8888:8888 \
    --env JUPYTER_ENABLE_LAB=yes

2. Connect to Workspace

# List running workspaces
runai list

# Port forward to access Jupyter
runai port-forward my-jupyter-workspace 8888:8888

Then open http://localhost:8888 in your browser.

Working with Data

Save Important Work

# Save notebooks to persistent storage
import shutil
shutil.copy("my-analysis.ipynb", "/mnt/datasets/notebooks/")

# Save model checkpoints
import torch
torch.save(model.state_dict(), "/mnt/datasets/models/checkpoint.pth")

Version Control Integration

# Clone your code repository
git clone https://github.com/your-org/ml-experiments.git /workspace/code

# Work with notebooks and commit changes
cd /workspace/code
git add experiment.ipynb
git commit -m "Add new experiment"
git push

Best Practices

  1. Resource Management:
  2. Start with small GPU fractions for development
  3. Stop workspaces when not actively using them
  4. Use appropriate image sizes (don't use full ML stacks for simple tasks)

  5. Data Organization:

  6. Store datasets in mounted PVCs for persistence
  7. Use git repositories for code and notebook version control
  8. Save model outputs to shared storage for team access

  9. Security:

  10. Don't store credentials in notebooks
  11. Use Run:AI credential assets for secure API access
  12. Clear outputs before committing notebooks to version control

Troubleshooting

Workspace Won't Start:

# Check project quota and events
runai describe <workspace-name>
runai describe project <project-name>

Can't Access Jupyter: - Verify workspace status is "Running" - Check the CONNECT button shows available tools - Try refreshing the browser or clearing cache

GPU Not Available:

# Test GPU access in Jupyter
import torch
print(f"GPU available: {torch.cuda.is_available()}")
!nvidia-smi

Next Steps

With your interactive workspace running:

  1. Experiment with different ML frameworks and libraries
  2. Connect datasets using the assets you created earlier
  3. Try GPU fractions to optimize resource usage
  4. Share notebooks with your team using version control