Hello,
I've attached the little ugly perl but hopefully helpful script I
mentioned in the meeting earlier. I used it to make some quick consistency
checks of the accounting information we published for various quarters.
It outputs the total CPU and Wall times extracted from the EventRecords
and LcgRecords tables. As our clusters are not used for local jobs, the
time data from the two tables should agree (see some ok output below).
They do not for our second CE (two CEs under one site name). I've
observed some inconsistencies at Oxford too.
I'd be very interested to know if other sites, in particular with multiple
CEs, have experienced problems too.
Thanks,
Yves
Q1 for epgce1.ph.bham.ac.uk (2007-01-01 - 2007-03-31)
----------------------------
EventRecords CPU time: 37274 Wall time: 51723
LcgRecords CPU time: 37274 Wall time: 51723
#!/usr/bin/perl -w
#use strict;
use DBI;
#use diagnostics;
#use Carp ();
#local $SIG{__WARN__} = \&Carp::cluck;
my $dsn = "DBI:mysql:accounting:epgmo1.ph.bham.ac.uk";
my $user_name = "????";
my $password = "****";
my $dbh = DBI->connect($dsn, $user_name, $password); # { Raiserror => 1, PrintError => 0});
my @celist = ("epgce1.ph.bham.ac.uk","epgce2.ph.bham.ac.uk");
my @quarters;
@quarters = ( {'beg' => '2007-01-01', 'end' => '2007-03-31'},
{'beg' => '2007-04-01', 'end' => '2007-06-30'},
{'beg' => '2007-07-01', 'end' => '2007-09-30'} );
my $sth;
my $myquery1;
my $myquery2;
$myquery1 = "select CpuDurationSeconds,WallDurationSeconds,EventDate from EventRecords where SubmitHost =";
$myquery2 = "select BaseCpuTimeSeconds,ElapsedTimeSeconds,EventDate from LcgRecords where ExecutingCE =";
querydb();
$dbh->disconnect();
exit(0);
sub querydb{
foreach my $ce (@celist) {
my $count = 1;
foreach my $q (@quarters) {
my $beg = $q->{"beg"};
my $end = $q->{"end"};
my $query="$myquery1" . " '$ce' and EventDate >= '$beg' and EventDate<= '$end'";
$sth = $dbh->prepare("$query");
$sth->execute();
my $cpupbs = 0 ;
my $wallpbs = 0 ;
while (my @ary = $sth->fetchrow_array())
{
@ary = map {defined($_) ? $_ : 0} @ary;
$cpupbs = $cpupbs + $ary[0];
$wallpbs = $wallpbs + $ary[1];
}
$query="$myquery2" . " '$ce' and EventDate >= '$beg' and EventDate<= '$end'";
$sth = $dbh->prepare("$query");
$sth->execute();
my $cpulcg = 0 ;
my $walllcg = 0 ;
while (my @ary = $sth->fetchrow_array())
{
@ary = map {defined($_) ? $_ : 0} @ary;
$ary[0] = 0 if $ary[0] eq "NULL";
$cpulcg = $cpulcg + $ary[0];
$walllcg = $walllcg + $ary[1];
}
printf "Q$count for $ce ($q->{'beg'} - $q->{'end'})\n";
printf "----------------------------\n";
printf "\n";
printf "EventRecords CPU time: %d Wall time: %d \n",$cpupbs/60/60,$walllcg/60/60;
printf "LcgRecords CPU time: %d Wall time: %d \n",$cpulcg/60/60,$walllcg/60/60;
printf "\n";
$count++;
}
}
}
|