-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathjobinfo
executable file
·36 lines (29 loc) · 958 Bytes
/
jobinfo
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
#!/bin/bash
nodes=`sinfo --format="%N" --noheader`
print_usage () {
cat << EOM
Usage: $0 [-n charles[01-19]] [-u username]
Get information about all jobs on specified nodes (defaults to all jobs).
Arguments:
-n (optional) specify nodes, either comma separated list, or summarised.
Mirrors slurm command -n usage in sinfo, and -w usage for squeue.
-u (optional) specify a user
Output:
Shows the output of 'scontrol show JobId=[job]' for each job on the specified nodes. If a user is specified with the
-u flag, then only details for jobs belonging to that user are printed.
EOM
}
while getopts 'n:u:' flag; do
case "${flag}" in
n) nodes="${OPTARG}" ;;
u) user="${OPTARG}" ;;
*) print_usage
exit ;;
esac
done
if [ -n "${user}" ]; then
user_arg="--user=${user}"
else
user_arg=""
fi
squeue --nodelist=${nodes} -o"%i" --noheader ${user_arg} | xargs -I {} sh -c 'scontrol show JobId={}'