Add walltime and node core hours.

Improve error handling.
This commit is contained in:
Jan Eitzinger 2019-04-29 11:32:27 +02:00
parent c92ebc4149
commit f7927ed297

View File

@ -152,12 +152,14 @@ sub buildCondition {
sub printJobStat {
my $conditionstring = shift;
my $query = 'SELECT COUNT(id), SUM(duration)/3600 FROM job '.$conditionstring;
my ($count, $coreHours) = $dbh->selectrow_array($query);
my $query = 'SELECT COUNT(id), SUM(duration)/3600, SUM(duration*num_nodes)/3600 FROM job '.$conditionstring;
my ($count, $walltime, $nodeHours) = $dbh->selectrow_array($query);
if ( $count > 0 ) {
print "=================================\n";
print "Job count: $count\n";
print "Core hours: $coreHours \n";
print "Total walltime [h]: $walltime \n";
print "Total node hours [h]: $nodeHours \n";
$query = 'SELECT num_nodes, COUNT(*) FROM job '.$conditionstring.' GROUP BY 1';
my @histo_num_nodes = $dbh->selectall_array($query);
@ -170,12 +172,15 @@ sub printJobStat {
$query = 'SELECT duration/3600, COUNT(*) FROM job '.$conditionstring.' GROUP BY 1';
my @histo_runtime = $dbh->selectall_array($query);
print "\nHistogram: Runtime\n";
print "\nHistogram: Walltime\n";
print "hours\tcount\n";
foreach my $bin ( @histo_runtime ) {
print "$bin->[0]\t$bin->[1]\n";
}
} else {
print "No jobs\n";
}
}