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
name
set todefault
andweight
set to1
has been created by Volcano. - No running tasks are in the cluster.
Operation
- If no other queues are created, queue
default
can use all CPUs. - Create queue
test
whose weight is3
. The CPU resource allocated to queuedefault
changes to 1C and that allocated to queuetest
is 3C because weight(default):weight(test) equals 1:3. - Create PodGroups
p1
andp2
, which belong to queuesdefault
andtest
, respectively. - Create job
j1
that has a CPU request of 1C inp1
. - Create job
j2
that has a CPU request of 3C inp2
. - Check the status of
j1
andj2
. 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
default
can use all CPUs. - Create PodGroup
p1
that belongs to queuedefault
. - Create job
j1
with a CPU request of 1C and jobj2
with a CPU request of 3C inp1
. Both the jobs are running normally. - Create queue
test
whose weight is3
. The CPU resource allocated to queuedefault
changes to 1C and that allocated to queuetest
is 3C because weight(default):weight(test) equals 1:3. As no tasks in queuetest
, jobs in queuedefault
can still run normally. - Create PodGroup
p2
that belongs to queuetest
. - Create job
j2
with a CPU request of 3C inp2
.j2
will 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
test
whosecapability
is 2C. - Create PodGroup
p1
that belongs to queuetest
. - Create job
j1
that has a CPU request of 1C inp1
.j1
runs normally. - Create job
j2
that has a CPU request of 3C inp1
.j2
becomespending
because 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
test
whosereclaimable
isfalse
andweight
is1
. The CPU resources allocated to queuesdefault
andtest
are both 2C. - Create PodGroups
p1
andp2
, which belong to queuestest
anddefault
, respectively. - Create job
j1
that has a CPU request of 3C inp1
.j1
runs normally because there are no tasks in queuedefault
. - Create job
j2
that has a CPU request of 2C inp2
. The status ofj2
ispending
becausereclaimable
is set tofalse
for queuetest
. Queuetest
will 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.