> ## Documentation Index
> Fetch the complete documentation index at: https://docs.usechamber.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Submit your first GPU workload with the Chamber Python SDK

This guide walks you through submitting and monitoring a GPU workload using the Python SDK.

<Tip>
  **New to containerization?** Try [`client.run()`](/sdk/python/run) to auto-containerize and submit your training project in one line, no Docker or Kubernetes expertise required.
</Tip>

## Prerequisites

* [Chamber SDK installed](/sdk/python/installation)
* [Authentication configured](/sdk/python/authentication)
* A team ID from your Chamber organization

## Submit a Workload

<Steps>
  <Step title="Import the SDK">
    ```python theme={null}
    from chamber_sdk import ChamberClient, JobClass, JobStatus
    ```
  </Step>

  <Step title="Initialize the Client">
    ```python theme={null}
    client = ChamberClient.from_config()
    # Or: client = ChamberClient()  # Uses CHAMBER_TOKEN env var
    ```
  </Step>

  <Step title="Submit a Workload">
    ```python theme={null}
    job = client.submit_job(
        name="my-training-job",
        initiative_id="your-team-id",
        gpu_type="H100",
        requested_gpus=4,
        job_class=JobClass.RESERVED,
        priority=50,
        tags={
            "model": "llama-7b",
            "dataset": "custom-v1"
        }
    )

    print(f"Workload ID: {job.id}")
    print(f"Status: {job.status}")
    ```
  </Step>

  <Step title="Monitor the Workload">
    ```python theme={null}
    # Poll for updates
    job = client.get_workload(job.id)
    print(f"Current status: {job.status}")

    # Or wait for completion
    result = client.wait_for_completion(
        job.id,
        poll_interval=30,  # Check every 30 seconds
        timeout=7200       # Timeout after 2 hours
    )

    if result.status == JobStatus.COMPLETED:
        print("Workload completed successfully!")
    else:
        print(f"Workload ended with status: {result.status}")
    ```
  </Step>
</Steps>

## Complete Example

```python theme={null}
from chamber_sdk import ChamberClient, JobClass, JobStatus

def run_training():
    # Initialize
    client = ChamberClient.from_config()

    # Check capacity first
    capacity = client.get_capacity()
    print(f"Available GPU hours: {capacity.budget.available}")

    # Submit workload
    job = client.submit_job(
        name="transformer-training",
        initiative_id="team-ml",
        gpu_type="H100",
        requested_gpus=8,
        job_class=JobClass.RESERVED,
        priority=75,
        tags={
            "experiment": "transformer-v2",
            "hyperparams": "lr=1e-4,batch=32"
        }
    )
    print(f"Submitted: {job.id}")

    # Wait for completion
    result = client.wait_for_completion(job.id, timeout=3600)

    # Get metrics
    if result.status == JobStatus.COMPLETED:
        metrics = client.get_workload_metrics(job.id)
        print(f"Avg GPU utilization: {metrics.gpu_utilization.avg:.1f}%")
        print(f"Peak memory: {metrics.memory_utilization.max:.1f}%")

    return result

if __name__ == "__main__":
    run_training()
```

## Using Templates

If your organization has workload templates configured, you can use them to simplify workload submission:

```python theme={null}
# List available templates
templates = client.list_templates(scope="ORGANIZATION")
for t in templates:
    print(f"{t.name}: {t.gpu_type} x {t.requested_gpus}")

# Submit using a template
job = client.submit_job(
    name="templated-job",
    initiative_id="team-ml",
    gpu_type="H100",
    template_id="template-abc123",
    tags={"experiment": "v1"}
)
```

## Cancelling a Workload

```python theme={null}
# Cancel a running or pending workload
cancelled = client.cancel_workload(job.id)
print(f"Workload cancelled: {cancelled.status}")  # CANCELLED
```

## Workload Classes

| Class      | Description                          | Use Case                                      |
| ---------- | ------------------------------------ | --------------------------------------------- |
| `RESERVED` | Guaranteed capacity, non-preemptible | Production training, time-sensitive workloads |
| `ELASTIC`  | Uses idle capacity, can be preempted | Experiments, fault-tolerant workloads         |

## Common Parameters

| Parameter        | Type      | Description                                |
| ---------------- | --------- | ------------------------------------------ |
| `name`           | str       | Human-readable workload name (1-255 chars) |
| `initiative_id`  | str       | Team ID                                    |
| `gpu_type`       | str       | GPU model (e.g., "H100", "A100")           |
| `requested_gpus` | int/float | Number of GPUs (can be fractional)         |
| `job_class`      | JobClass  | RESERVED or ELASTIC (default: RESERVED)    |
| `priority`       | int       | 0-100, higher = more important             |
| `tags`           | dict      | Key-value pairs for organizing workloads   |

## Next Steps

<CardGroup cols={2}>
  <Card title="Auto-Containerize & Run" icon="wand-magic-sparkles" href="/sdk/python/run">
    One-liner workload submission
  </Card>

  <Card title="List & Filter Workloads" icon="list" href="/sdk/python/api-reference#list_workloads">
    Query and filter your workloads
  </Card>

  <Card title="Distributed Training" icon="network-wired" href="/sdk/python/api-reference#distributed-training">
    Run multi-node distributed workloads
  </Card>

  <Card title="API Reference" icon="code" href="/sdk/python/api-reference">
    Complete SDK documentation
  </Card>
</CardGroup>
