client.run() method is designed for scientists and ML practitioners who want to submit GPU workloads without needing expertise in Docker or Kubernetes. Point it at your training project and let the SDK handle the rest.
Install with the
run extra to use this feature:Why Use client.run()?
Traditional GPU workload submission requires:
- Writing a Dockerfile optimized for your ML framework
- Choosing the right base image (CUDA version, framework version, etc.)
- Building and pushing the container image
- Authenticating to your container registry
- Writing a Kubernetes manifest
- Submitting via the API
client.run(), all of this happens automatically:
What It Does Automatically
Framework Detection
Analyzes your
requirements.txt to identify PyTorch, TensorFlow, JAX, or other frameworks and selects the optimal NVIDIA NGC base image.Dockerfile Generation
Creates an optimized Dockerfile with proper CUDA configuration, dependency installation, and entrypoint setup.
Container Build & Push
Uses
docker buildx build --push to build and push in a single efficient step. For AWS ECR and Google Artifact Registry, authentication and repository creation are handled automatically. Pulls the :latest tag to seed the layer cache for faster rebuilds.Kubernetes Manifest
Generates the appropriate manifest (Job or RayJob) with correct GPU resource requests, environment variables, and volume mounts.
Supported Container Registries
Chamber automatically handles authentication and repository creation for major cloud registries. Just provide your registry URL and the SDK does the rest.Google Artifact Registry
Full auto-authentication via gcloud CLI. Repositories are created automatically if they don’t exist.
AWS ECR
Full auto-authentication via AWS CLI. Repositories are created automatically if they don’t exist.
| Registry | URL Pattern | Auto-Auth | Auto-Create Repo |
|---|---|---|---|
| Google Artifact Registry | {region}-docker.pkg.dev/{project}/{repo} | ✅ | ✅ |
| AWS ECR | {account}.dkr.ecr.{region}.amazonaws.com | ✅ | ✅ |
| Other registries | Any Docker-compatible registry | Manual | Manual |
Prerequisites
Docker
Docker must be installed and running on your machine. The SDK uses Docker to build and push images.
gcloud CLI
For Google Artifact Registry. Install and run
gcloud auth login.AWS CLI
For AWS ECR. Install and run
aws configure.- Google Artifact Registry
- AWS ECR
Setup:Required IAM Permissions:
artifactregistry.repositories.getartifactregistry.repositories.createartifactregistry.repositories.uploadArtifacts
Basic Usage
Minimal Example
- Google Artifact Registry
- AWS ECR
With Progress Callbacks
Monitor each stage of the pipeline:- Google Artifact Registry Output
- AWS ECR Output
Wait for Completion
Block until the workload finishes:Registry Configuration
Configure your container registries once and reference them by name. This makes it easy to switch between dev/staging/prod environments.Setting Up Named Registries
Add registries to~/.chamber/config.json:
Using Named Registries
Once configured, use registries by name:Configuration File
Create a.chamber.yaml file in your project directory to avoid repeating parameters:
Dry Run (Preview Mode)
Preview exactly what will happen without building or submitting:Save Generated Files
Inspect the generated Dockerfile and manifest:Framework Detection
The SDK automatically detects your ML framework fromrequirements.txt and selects the optimal base image:
| Framework | Detected From | Base Image |
|---|---|---|
| PyTorch | torch, pytorch | nvcr.io/nvidia/pytorch:24.04-py3 |
| TensorFlow | tensorflow, keras | nvcr.io/nvidia/tensorflow:24.04-tf2-py3 |
| JAX | jax, jaxlib | nvcr.io/nvidia/jax:24.04-py3 |
| Generic | (fallback) | nvcr.io/nvidia/cuda:12.4.1-devel-ubuntu22.04 |
Distributed Training
The SDK auto-detects distributed training frameworks and configures the appropriate launch command:| Framework | Detected From | Launch Command |
|---|---|---|
| DeepSpeed | deepspeed in requirements | deepspeed --num_gpus N train.py |
| Accelerate | accelerate in requirements | accelerate launch train.py |
| Ray | ray in requirements | Creates RayJob K8s manifest |
| Horovod | horovod in requirements | Uses standard launcher |
Using an Existing Dockerfile
Skip Dockerfile generation and use your own:Registry Auto-Authentication
The SDK automatically detects your registry type and handles authentication seamlessly. No manualdocker login required.
- Google Artifact Registry
- AWS ECR
When using Google Artifact Registry, the SDK automatically:Supported regions: All GCP regions (us-central1, us-east1, europe-west1, asia-northeast1, etc.)
- Detects GAR registry URLs (pattern:
{region}-docker.pkg.dev/{project}/{repo}) - Authenticates Docker using your gcloud CLI credentials
- Creates the repository if it doesn’t exist
How It Works
When you callclient.run(), the SDK:
This means you can switch between registries just by changing the URL—no code changes required.
All Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
directory | str | required | Path to project directory |
gpus | int | 1 | Number of GPUs |
gpu_type | str | ”H100” | GPU type (H100, A100, L40S, etc.) |
team | str | None | Team ID (required) |
name | str | directory name | Workload name |
entrypoint | str | auto-detect | Python entry point |
entrypoint_args | str | None | CLI arguments for entrypoint |
registry | str | None | Registry name (e.g., “prod”) or URL. Uses default if not specified. |
base_image | str | auto-select | Override base Docker image |
dockerfile | str | None | Path to existing Dockerfile |
distributed | str | ”auto" | "auto”, “ray”, “deepspeed”, or “none” |
job_class | str | ”ELASTIC" | "RESERVED” or “ELASTIC” |
env | dict | None | Environment variables |
no_cache | bool | False | Force rebuild even if image exists |
dry_run | bool | False | Preview without executing |
save_dockerfile | bool | False | Save generated Dockerfile |
save_manifest | bool | False | Save generated K8s manifest |
wait | bool | False | Wait for workload completion |
poll_interval | float | 10.0 | Seconds between status checks |
timeout | float | None | Max wait time in seconds |
on_progress | callable | None | Progress callback(stage, message) |
Error Handling
Configuration Priority
Settings are resolved in this order (highest priority first):- Function arguments —
client.run(..., gpus=8)overrides everything - Project
.chamber.yaml— Project-specific settings - Global
~/.chamber/config.json— Default registry and other global settings - Auto-detection — Framework, entrypoint, Python version
Registry Resolution
Theregistry parameter can be a name or URL:
- If it looks like a URL (contains
.or/), it’s used as-is - Otherwise, it’s looked up in
~/.chamber/config.jsonunderregistries - If not specified, the
default_registryfrom config is used
Caching
The SDK computes a content hash of your project and uses it as the image tag. If the image already exists in the registry, the build and push steps are skipped:no_cache=True:
Docker Build Optimizations
The SDK automatically applies several optimizations to make builds fast:| Optimization | What it does |
|---|---|
| Single build+push | Uses docker buildx build --push to build and push in one step. This is significantly faster than separate build+push because buildkit pushes layers directly as they complete |
| BuildKit | Enabled by default (DOCKER_BUILDKIT=1) for parallel build stages and advanced caching |
| Pip cache mounts | Uses --mount=type=cache,target=/root/.cache/pip so pip packages are cached across builds |
| Remote layer caching | Pulls the :latest tag before building to seed the layer cache. After a successful build, creates a :latest tag alias using docker buildx imagetools create (fast manifest aliasing, no layer re-upload) |
| Content-addressed tags | Images are tagged with a content hash. If the image already exists, build and push are skipped entirely |
| Platform targeting | Explicitly builds for linux/amd64 to ensure consistent images |
| Reduced metadata | Uses --provenance=false --sbom=false to skip unnecessary metadata generation |
| Context size warnings | Reports build context size and warns if it exceeds 500MB |

