Skip to content

Compute Jobs

Compute jobs (kind: compute) are for deploying CPU-only services such as web servers, databases, caches, and proxies. They map to a Kubernetes Deployment + NodePort Service, with support for multiple replicas and health checks.

Full YAML Fields

kind: compute
version: v0.1

job:
  name: <service-name>
  priority: medium
  description: "..."

environment:
  image: <image>
  command: [...]   # Optional — uses the image's default entrypoint if omitted
  args: [...]      # Optional
  env:
    - name: KEY
      value: VALUE

service:
  replicas: 1       # Number of replicas (default: 1)
  port: 80          # Service port
  healthCheck: /    # Health check path (optional)

resources:
  pool: default
  gpu: 0            # Set to 0 for CPU-only compute jobs
  cpu: 2
  memory: 4Gi

storage:
  workdirs:
    - path: /data

Example 1: Deploy an Nginx Web Service

nginx-service.yaml
kind: compute
version: v0.1

job:
  name: nginx-web
  priority: medium
  description: "Nginx static web service"

environment:
  image: nginx:latest
  command: []
  args: []
  env:
    - name: NGINX_PORT
      value: "80"

service:
  replicas: 2
  port: 80
  healthCheck: /

resources:
  pool: compute-pool
  gpu: 0
  cpu: 2
  memory: 4Gi

storage:
  workdirs:
    - path: /etc/nginx/conf.d
    - path: /var/www/html
gpuctl create -f nginx-service.yaml
gpuctl describe job nginx-web    # View access address

Example 2: Deploy a Redis Cache

redis-cache.yaml
kind: compute
version: v0.1

job:
  name: redis-cache
  priority: medium

environment:
  image: redis:7.0-alpine
  command: ["redis-server"]
  args: ["--maxmemory", "1gb", "--maxmemory-policy", "allkeys-lru"]

service:
  replicas: 1
  port: 6379

resources:
  pool: default
  gpu: 0
  cpu: 1
  memory: 2Gi

storage:
  workdirs:
    - path: /data   # Redis persistence directory

Example 3: Deploy a Custom Python API Service

fastapi-service.yaml
kind: compute
version: v0.1

job:
  name: my-fastapi-service
  priority: medium

environment:
  image: my-registry/fastapi-app:v1.0
  command: ["uvicorn", "main:app"]
  args: ["--host", "0.0.0.0", "--port", "8080"]
  env:
    - name: DATABASE_URL
      value: "postgresql://user:pass@db:5432/mydb"
    - name: LOG_LEVEL
      value: "info"

service:
  replicas: 3
  port: 8080
  healthCheck: /health

resources:
  pool: default
  gpu: 0
  cpu: 4
  memory: 8Gi

Updating a Compute Job

# After modifying the YAML (e.g. changing replica count or image version):
gpuctl apply -f nginx-service.yaml

Viewing Service Logs

gpuctl logs nginx-web -f

Deleting a Compute Job

gpuctl delete job nginx-web

Difference from Inference Jobs

Both compute and inference use a K8s Deployment under the hood. The key difference is semantic labeling (runwhere.ai/job-type) and resource pool selection. Compute jobs typically have gpu: 0; inference jobs typically require GPUs.