Commit 557f903f authored by Alain O' Miniussi's avatar Alain O' Miniussi

Dispatch the collected data in convenient file hierachy

parent ef769319
#!/usr/bin/env bash
sdate=01.01.19
edate=02.01.19
sdate=05.01.19
edate=06.01.19
# Labs are directly under the root account
# There is a documented bug in sacct that will print all accounts whatever the filter
# That is, Parent=root only main concequence is that the parent name will only be printed
# if it's root and left banck otherwise.
labs=$(sacctmgr show account WithAssoc format=Account,ParentName Parent=root -P -n | egrep -v "\|$" | sed -e 's/|root//')
rm -rf ./cpu_times
mkdir ./cpu_times
for lab in $labs
do
mkdir ./cpu_times/$lab
lab_cpu_time=0
teams=$(sacctmgr show account WithAssoc format=Account,ParentName Parent=$lab -P -n | egrep -v "\|$" | sed -e "s/|$lab//")
for team in $teams
do
cpu_time=$((echo 0; sacct -n -X -S $sdate -E $edate -o CPUTimeRAW -A $team) | paste -sd+ - | bc)
echo $lab:$team:$cpu_time
let lab_cpu_time+=$cpu_time
echo "$team $cpu_time" >> ./cpu_times/$lab/teams
done
cpu_time=$((echo 0; sacct -n -X -S $sdate -E $edate -o CPUTimeRAW -A $lab) | paste -sd+ - | bc)
echo $lab:other:$cpu_time
echo "<other> $cpu_time" >> ./cpu_times/$lab/teams
sort -k2 -n -r ./cpu_times/$lab/teams > ./cpu_times/$lab/teams.sorted
let lab_cpu_time+=$cpu_time
echo $lab_cpu_time > ./cpu_times/$lab/_total
done
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment