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-nameSee queues for scheduling behavior.
Request Resources
Set CPU, memory, and accelerator requests under run.container.resources. Presets and cluster policies can patch or constrain these values:
run:
kind: service
container:
image: python:3.11
resources:
requests:
cpu: "1"
memory: 2Gi
limits:
cpu: "2"
memory: 4Gi
nvidia.com/gpu: "1"
command: ["sleep", "infinity"]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-devUse 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.