Skip to content

Latest commit

 

History

History
155 lines (132 loc) · 5.84 KB

README.md

File metadata and controls

155 lines (132 loc) · 5.84 KB

Scheduling Queues

Scheduling queues are the core resource management primitive in KAI Scheduler, providing hierarchical resource allocation with quota guarantees and priority-based distribution.

Only leaf queues (queues with no children) can be used for scheduling jobs. Parent queues serve as organizational units for resource distribution among their child queues.

Table of Contents

Queue Attributes

Attribute Description Units
Quota Guaranteed resource allocation CPU: millicores, Memory: MB, GPU: units
Queue Priority Resource allocation order when exceeding quota; can also affect in-quota reclaim when queuePriorityInQuotaReclaim is enabled, see Fairness Policies Integer (higher = first)
Over-Quota Weight Resource distribution weight within priority level Integer
Limit Hard cap on resource consumption Same as quota

Limits and quota are also enforced when running pods are resized in place; see In-Place Pod Resize.

API Reference

Queue Specification

apiVersion: scheduling.run.ai/v2
kind: Queue
metadata:
  name: example-queue
spec:
  displayName: "Example Queue"           # Optional: logging purposes
  parentQueue: "parent-queue"            # Optional: hierarchical structure
  priority: 100                          # Optional: allocation precedence
  resources:
    cpu: ResourceQuota
    memory: ResourceQuota
    gpu: ResourceQuota

Resource Quota Structure

resources:
  cpu:
    quota: 2000                          # 2 CPU cores guaranteed
    overQuotaWeight: 1                   # Distribution weight
    limit: 4000                          # Max 4 CPU cores
  memory:
    quota: 4096                          # 4GB guaranteed
    overQuotaWeight: 1
    limit: 8192                          # Max 8GB
  gpu:
    quota: 2                             # 2 GPU units guaranteed
    overQuotaWeight: 1
    limit: 4                             # Max 4 GPU units

Resource Configuration

Special Values

Field Value Behavior
quota -1 Unlimited quota
quota 0 or unset No guaranteed resources (default)
limit -1 No limit
limit 0 or unset No resources of this type can be allocated to the queue, including its quota (default)

Each resource (cpu, memory, gpu) is checked on its own. If a queue omits a resource or its limit, the limit for that resource is 0, and workloads that request it stay pending with an OverLimit condition such as Limit is 0 GB. Set limit: -1 for every resource you do not want to cap.

Resource Units

  • CPU: Millicores (1000 = 1 CPU core)

  • Memory: Megabytes (MB = 10⁶ bytes)

  • GPU: Queue quota and limit use aggregate GPU units:

    • Each requested whole GPU (nvidia.com/gpu) counts as 1 unit.
    • A fractional GPU request counts by its requested fraction per device. For example, two pods each requesting gpu-fraction: "0.5" consume 1 unit together. Memory-based fractional requests are converted to GPU units using the requested memory and GPU memory capacity. See GPU Sharing.
    • Each requested MIG device (nvidia.com/mig-Xg.Ygb) counts as X units, where X is the number before g in the profile name. See supported MIG profiles.

    Whole GPUs, fractional requests, and MIG devices share the same queue quota and limit. These fields do not reserve a particular MIG profile or guarantee that a matching device is available. GPU units are not physical GPU equivalents: a whole GPU counts as 1, while a mig-7g.* device counts as 7.

Examples

GPU Quota with MIG and Fractional Requests

For a queue with gpu.quota: 2 and gpu.limit: 2, two mig-1g.* devices, one mig-2g.* device, or two whole GPUs each consume 2 GPU units and reach the limit. One mig-3g.* device consumes 3 units and exceeds the limit. Requests within the limit still require suitable devices to be available.

Two pods each requesting gpu-fraction: "0.5" consume 1 unit together. Adding one mig-1g.* device consumes the second unit and reaches the same limit.

Basic Queue

apiVersion: scheduling.run.ai/v2
kind: Queue
metadata:
  name: research-team
spec:
  displayName: "Research Team"
  resources:
    cpu:
      quota: 1000
      limit: 2000
    memory:
      quota: 0
      limit: -1
    gpu:
      quota: 1
      limit: 2

Hierarchical Queue

apiVersion: scheduling.run.ai/v2
kind: Queue
metadata:
  name: ml-team
spec:
  displayName: "ML Team"
  parentQueue: "research-team"
  priority: 200
  resources:
    cpu:
      quota: 500
      overQuotaWeight: 2
      limit: -1
    memory:
      quota: 0
      limit: -1
    gpu:
      quota: 1
      overQuotaWeight: 1
      limit: -1

Unlimited Queue

-1 is not filled in for you: set it on every resource.

apiVersion: scheduling.run.ai/v2
kind: Queue
metadata:
  name: burst-queue
spec:
  resources:
    cpu:
      quota: -1                          # Unlimited quota
      limit: -1                          # No limit
    memory:
      quota: -1                          # Unlimited quota
      limit: -1                          # No limit
    gpu:
      quota: 0                           # No guarantee
      limit: -1                          # No limit

See Also