DocsResources and GPUs
v2.19+

Resources and GPUs

Sandboxes consume cluster resources for as long as the backing service run is active. Request only what the session needs and stop it when work is complete.

This page reuses sandbox/sandbox.yaml and the quick-start project from the Sandbox Quick Start. Each Python or CLI run example below starts a new service. Python returns the UUID on the run object; for later CLI commands, replace the current value of RUN_UUID with the new run UUID.

Select a Queue

Use queues to route sandboxes to the right agent (compute cluster) or resource pool:

from polyaxon.client import RunClient

queue_client = RunClient(project="quick-start")
queue_run = queue_client.create_from_polyaxonfile(
    polyaxonfile="sandbox/sandbox.yaml",
    queue="agent-name/queue-name",
    approved=True,
)
print(queue_run.uuid)
polyaxon run -p quick-start -f sandbox/sandbox.yaml -q agent-name/queue-name

See queues for scheduling behavior.

Request Resources

Add the root resources shortcut to sandbox/sandbox.yaml. This example requests 1 CPU, 2Gi memory, and 1 GPU, with CPU and memory limits of 2 and 4Gi:

resources:
  cpu: "1..2"
  memory: 2Gi..4Gi
  gpu: 1

Or set the same values for one launch:

polyaxon run -p quick-start -f sandbox/sandbox.yaml --cpu 1..2 --memory 2Gi..4Gi --gpu 1

Presets and cluster policies can patch or constrain these values.

For reusable sandbox profiles, prefer presets:

from polyaxon.client import RunClient

gpu_client = RunClient(project="quick-start")
gpu_run = gpu_client.create_from_polyaxonfile(
    polyaxonfile="sandbox/sandbox.yaml",
    presets=["gpu-dev"],
    approved=True,
)
print(gpu_run.uuid)
polyaxon run -p quick-start -f sandbox/sandbox.yaml --presets gpu-dev

Use GPUs

GPU sandboxes are useful for profiling, interactive model debugging, and notebook exploration. Make sure the selected queue can schedule GPU workloads and that the image matches the GPU runtime requirements.

For node selectors, priority, annotations, and other Kubernetes placement controls, see resources scheduling and node scheduling.

Cost Controls

Use timeouts and culling presets for long-running interactive services:

See the Python run client reference or the run CLI reference for the full interfaces.