Interactive Workload¶
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¶
- Navigate to Workload manager → Workloads
- Click "+NEW WORKLOAD"
- Select "Workspace" from the workload types
3. Configure Basic Settings¶
- Select Cluster and Project: Choose your target cluster and the project you want to use
- Template Selection: Choose "Start from Scratch" for full control
- Workload Name: Enter a unique, descriptive name for your workspace
4. Environment Configuration¶
- Environment: Select "jupyter-lab" from the available environments
- This uses the
jupyter/scipy-notebook
image - Includes common data science libraries pre-installed
- Container Configuration: The system will automatically configure:
- Base URL settings
- Authentication token
- Port mapping
5. Compute Resources¶
- GPU Allocation: Select "one-gpu" compute resource
- This allocates one full GPU to your workspace
- You can also choose fractional GPU options if available
- 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:
7. Submit the Workspace¶
- Review your configuration
- Click "CREATE WORKLOAD"
- Monitor the deployment in the workload manager
8. Connect to Jupyter¶
Once the workspace is running:
- Locate Your Workspace: Find it in the workload manager list
- Click "CONNECT": This opens connection options
- Select "Jupyter": Choose the Jupyter tool from available options
- 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¶
- Resource Management:
- Start with small GPU fractions for development
- Stop workspaces when not actively using them
-
Use appropriate image sizes (don't use full ML stacks for simple tasks)
-
Data Organization:
- Store datasets in mounted PVCs for persistence
- Use git repositories for code and notebook version control
-
Save model outputs to shared storage for team access
-
Security:
- Don't store credentials in notebooks
- Use Run:AI credential assets for secure API access
- 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:
- Experiment with different ML frameworks and libraries
- Connect datasets using the assets you created earlier
- Try GPU fractions to optimize resource usage
- Share notebooks with your team using version control
Related Guides¶
- Understanding Assets - Learn about environments and data sources
- GPU Fractions Tutorial - Optimize GPU resource usage
- Distributed Training Quickstart - Scale beyond single GPU