forked from OleHolmNielsen/Slurm_tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtopreports
executable file
·58 lines (52 loc) · 1.48 KB
/
topreports
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env bash
# Make Slurm cluster usage statistics
# Usage: topreports [monthyear]
# Default periods: last-month ("") current-month (-c) current-week (-w)
# Author: [email protected]
# Homepage: https://github.com/OleHolmNielsen/Slurm_tools/
# CONFIGURE:
# Directory and report file name prefix:
PREFIX=/TOPDIR/Top
# Partion list: similar, overlapping partitions are comma-separated
partitionlist="xeon8,xeon8_48 xeon16,xeon16_128,xeon16_256 xeon24,xeon24_512 xeon40,xeon40_768,xeon40_clx,sm3090"
# END CONFIGURE
slurmacct=slurmacct
if test $# -eq 0
then
# Default periods: last-month ("") current-month (-c) current-week (-w)
periods="None -c -w"
else
# Select month and year (like "november2019")
periods="-m$1"
fi
# The empty string selects the default period (last month)
for period in $periods
do
echo "================================================"
echo
echo Generating reports for period=$period
echo
if test "$period" = "None"
then
period=""
fi
# The empty string selects all partitions in the cluster
for p in "" $partitionlist
do
if test -z "$p"
then
name="."
partition=""
else
name=`echo $p | cut -f1 -d,` # Select first field in a,b,...
name=."$name."
partition="-p $p"
fi
echo
echo Generating report for partition=$partition and period=$period
echo Group report
$slurmacct -G $partition $period -r $PREFIX$name # Group report
echo User report
$slurmacct -n $partition $period -r $PREFIX$name # Append user report
done
done