-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbqstat
More file actions
executable file
·39 lines (35 loc) · 1.33 KB
/
bqstat
File metadata and controls
executable file
·39 lines (35 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
(( DEBUG )) && set -x
[[ $1 == "-h" ]] && {
cat <<EOF
bqstat [-h]
Prints that status of the gpu queues for the cluster. Let's you see the number of
admitted (active), pending and reserved jobs on each queue. Additionally, it displays
how many gpus service the queue and the queueing strategy for the queue.
See repository README.md for more documentation and examples.
EOF
exit 0
}
# my initial version
#oc get clusterqueue -o json | \
#jq -r '
#.items[] |
#"\(.metadata.name?)\tadmitted: \(.status.admittedWorkloads?) pending: \(.status.pendingWorkloads?) reserved: \(.status.reservingWorkloads?) resources:\(.spec.resourceGroups[].flavors[].resources[].nominalQuota) \(.spec.queueingStrategy) " '
# refined with ChatGPT o4-mini
oc get clusterqueue -o json \
| jq -r '
.items[] |
# compute total GPU quota, defaulting to 0 if no nvidia.com/gpu entry
( ( [ .spec.resourceGroups[]?
| .flavors[]?
| .resources[]?
| select(.name == "nvidia.com/gpu")
| (.nominalQuota? | tonumber? // 0)
]
| add
) // 0
| tostring
) as $gpuQuota |
# now print your line
"\(.metadata.name)\t admitted: \(.status.admittedWorkloads // 0) pending: \(.status.pendingWorkloads // 0) reserved: \(.status.reservingWorkloads // 0) GPUS:\($gpuQuota) \(.spec.queueingStrategy)"
'