-
Notifications
You must be signed in to change notification settings - Fork 99
/
Copy pathshowjobreasons
executable file
·34 lines (32 loc) · 1.15 KB
/
showjobreasons
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
#!/usr/bin/env bash
# Slurm batch queue: Show list of reasons for pending jobs
# Only job reasons other than "Priority", "Resources" and "Dependency" are shown.
# Options such as "-p partition" etc. are passed to the squeue command:
squeue $@ -h -t pending -O "Username,Account,Partition,MaxCPUs,MaxNodes,Reason: " | sort | uniq -c | awk '
BEGIN {
# Collect partition information using "showpartitions" from this project
while (("showpartitions -n" | getline) > 0) {
p = $1
len = length(p) # Length of partition name string
if (len > plen) plen = len # Calculate maximum string length
nodes[p] = $3
idlenodes[p] = $4
cores[p] = $5
idlecores[p] = $6
}
fmt="%8s %8s \t%12s\t%-16s %5s %5s %5s %5s %5s\n"
printf(fmt, "User", "Account", "Partition", "Reason", "#Jobs", "Nodes", "Idle", "Cpus", "Idle")
}
{
jobcount=$1 # The jobcount comes from "uniq -c"
username=$2
account=$3
p=$4 # Partition name
numcpus=$5
numnodes=$6
reason=$7
if (reason !~ "Priority" && reason !~ "Resources" && reason !~ "Dependency") {
printf(fmt,
username, account, p, reason, jobcount, numnodes*jobcount, idlenodes[p], numcpus*jobcount, idlecores[p])
}
}'