-2

I would like to automate the estimation of monthly memory usage of all jobs performed by a given user in my cluster (SGE, ubuntu). I have seen there are many tools to compute the current memory usage for a particular user, but I want to calculate the CPU usage of the submitted jobs. Is this possible? Is there any tool to look into the history of submitted jobs and to find the memory they used?

Thanks

Paco el Cuqui
  • 199
  • 1
  • 1
  • 8

2 Answers2

2

I have just realised you can check how much memory a user has used with

qacct -j -o <username>
Paco el Cuqui
  • 199
  • 1
  • 1
  • 8
0

The following script computes the CPU time (in hours) per user (for all users in /etc/passwd file) in the last month:

#!/bin/sh
bmonth=$(/bin/date +%m)
bmonth=$(($bmonth - 1))
year=$(/bin/date +%y)

if [ $bmonth -eq 0 ];then
    bmonth=12
    year=$((year-1))
fi

if [ $bmonth -lt 10 ];then
    bmonth=0$bmonth
fi

emonth=$(/bin/date +%m)
hour=00
minute=00
day=$(/bin/date +%d)
begin=$year$bmonth$day$hour$minute
end=$year$emonth$day$hour$minute

for user in $(/usr/bin/cut -d':' -f1 /etc/passwd); do
    /usr/bin/qacct -j -o $user -b $begin -e $end | /bin/grep cpu | /usr/bin/awk '{sum += $2} END {sum = sum/3600; print "'$user'", sum}' OFS='\t';
done
Paco el Cuqui
  • 199
  • 1
  • 1
  • 8