Introduction
Queue is a collection of PodGroups, which adopts FIFO. It is also used as the basis for resource division.
Example
apiVersion: scheduling.volcano.sh/v1beta1
kind: Queue
metadata:
creationTimestamp: "2020-08-10T11:54:36Z"
generation: 1
name: default
resourceVersion: "559"
selfLink: /apis/scheduling.volcano.sh/v1beta1/queues/default
uid: 14082e4c-bef6-4248-a414-1e06d8352bf0
spec:
reclaimable: true
weight: 1
capability:
cpu: "4"
memory: "4096Mi"
status:
state: Open
Key Fields
weight
weight indicates the relative weight of a queue in cluster resource division. The resource allocated to the queue equals (weight/total-weight) x total-resource. total-weight is the total weight of all queues. total-resource is the total number of cluster resources. weight is a soft constraint.
capability
capability indicates the upper limit of resources the queue can use. It is a hard constraint.
reclaimable
reclaimable specifies whether to allow other queues to reclaim extra resources occupied by a queue when the queue uses more resources than allocated. The default value is true.
Status
Open
Open indicates that the queue is available and can accept new PodGroups.
Closed
Closed indicates that the queue is unavailable and cannot accept any new PodGroups.
Closing
Closing indicates that the queue is becoming unavailable. It is a transient state. A Closing queue cannot accept any new PodGroups.
Unknown
Unknown indicates that the queue status is unknown because of unexpected situations such as network jitter.
Usage
Weight for Cluster Resource Division - 1
Preparations
- A total of 4 CPUs in a cluster are available.
- A queue with
nameset todefaultandweightset to1has been created by Volcano. - No running tasks are in the cluster.
Operation
- If no other queues are created, queue
defaultcan use all CPUs. - Create queue
testwhose weight is3. The CPU resource allocated to queuedefaultchanges to 1C and that allocated to queuetestis 3C because weight(default):weight(test) equals 1:3. - Create PodGroups
p1andp2, which belong to queuesdefaultandtest, respectively. - Create job
j1that has a CPU request of 1C inp1. - Create job
j2that has a CPU request of 3C inp2. - Check the status of
j1andj2. Both the jobs are running normally.
Weight for Cluster Resource Division - 2
Preparations
- A total of 4 CPUs in a cluster are available.
- A queue with name set to default and weight set to 1 has been created by Volcano.
- No running tasks are in the cluster.
Operation
- If no other queues are created, queue
defaultcan use all CPUs. - Create PodGroup
p1that belongs to queuedefault. - Create job
j1with a CPU request of 1C and jobj2with a CPU request of 3C inp1. Both the jobs are running normally. - Create queue
testwhose weight is3. The CPU resource allocated to queuedefaultchanges to 1C and that allocated to queuetestis 3C because weight(default):weight(test) equals 1:3. As no tasks in queuetest, jobs in queuedefaultcan still run normally. - Create PodGroup
p2that belongs to queuetest. - Create job
j2with a CPU request of 3C inp2.j2will be evicted to return the resource to queuetest.
Capability for Overuse of Resources
Preparations
- A total of 4 CPUs in a cluster are available.
- A queue with name set to default and weight set to 1 has been created by Volcano.
- No running tasks are in the cluster.
Operation
- Create queue
testwhosecapabilityis 2C. - Create PodGroup
p1that belongs to queuetest. - Create job
j1that has a CPU request of 1C inp1.j1runs normally. - Create job
j2that has a CPU request of 3C inp1.j2becomespendingbecause of the limit ofcapability.
Reclaimable for Resource Return
Preparations
- A total of 4 CPUs in a cluster are available.
- A queue with name set to default and weight set to 1 has been created by Volcano.
- No running tasks are in the cluster.
Operation
- Create queue
testwhosereclaimableisfalseandweightis1. The CPU resources allocated to queuesdefaultandtestare both 2C. - Create PodGroups
p1andp2, which belong to queuestestanddefault, respectively. - Create job
j1that has a CPU request of 3C inp1.j1runs normally because there are no tasks in queuedefault. - Create job
j2that has a CPU request of 2C inp2. The status ofj2ispendingbecausereclaimableis set tofalsefor queuetest. Queuetestwill NOT return resources to other queues until some tasks in it are completed.
Note
default Queue
When Volcano starts, it automatically creates queue default whose weight is 1. Subsequent jobs that are not assigned to a queue will be assigned to queue default.
Soft Constraint About weight
weight determines the resources allocated to a queue, but not the upper limit. As per the preceding examples, a queue can use more resources than allocated when there are idle resources in other queues. This a good characteristic of Volcano and delivers a better cluster resource usage.