forked from paulmezz/slurm-stats
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generatePlot.sh
executable file
·77 lines (46 loc) · 1.46 KB
/
generatePlot.sh
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
# Author: Aaron Herting
# License: MIT
function lockcheck {
while [[ -n `ls /var/lock/slurmplot` ]] ; do
sleep 10
done
}
TMP_DIR="/dev/shm/accounting"
USER_LIST="$TMP_DIR/users.txt"
CORES_TO_USE=9
# Ensure tmpdir is in exastince
mkdir -p $TMP_DIR
touch $TMP_DIR/unstandard.psv
# Collect accounting data
sacct -L -P --starttime=0601 --format=jobid,partition,user,elapsed,submit,start,end | tail -n +2 > $TMP_DIR/unstandard.psv
mkdir -p $TMP_DIR/unstandard.psv.d/
#split -n "l/$CORES_TO_USE" -d $TMP_DIR/unstandard.psv $TMP_DIR/unstandard.psv.d/
LINES=`wc -l $TMP_DIR/unstandard.psv | awk '{ print $1 ; }'`
LINES_PER=`echo -e "$CORES_TO_USE\t$LINES" | awk '{ print $2 / ( $1 - 1 ) ;}' | awk -F. '{ print $1; }'`
echo $CORES_TO_USE
echo $LINES
echo $LINES_PER
split -l "$LINES_PER" -d $TMP_DIR/unstandard.psv $TMP_DIR/unstandard.psv.d/
mkdir -p /var/lock/slurmplot
rm $TMP_DIR/account.dat
touch $TMP_DIR/account.dat
for file in $TMP_DIR/unstandard.psv.d/* ; do
cat $file | ./process_section.sh >> $TMP_DIR/account.dat &
done
lockcheck
# list users
rm $TMP_DIR/users.txt
touch $TMP_DIR/users.txt
for file in $TMP_DIR/unstandard.psv.d/* ; do
cat $file | ./dump_users.sh >> $TMP_DIR/users.txt &
done
lockcheck
mv $TMP_DIR/users.txt $TMP_DIR/users.txt.old
cat $TMP_DIR/users.txt.old | sort | uniq > $TMP_DIR/users.txt
# Pull User data
mkdir -p $TMP_DIR/userData
for user in `cat $USER_LIST` do
./process_user.sh $user $USER_LIST &
done
lockcheck