mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-11-10 08:57:25 +01:00
Add walltime and node core hours.
Improve error handling.
This commit is contained in:
parent
c92ebc4149
commit
f7927ed297
13
acQuery.pl
13
acQuery.pl
@ -152,12 +152,14 @@ sub buildCondition {
|
|||||||
sub printJobStat {
|
sub printJobStat {
|
||||||
my $conditionstring = shift;
|
my $conditionstring = shift;
|
||||||
|
|
||||||
my $query = 'SELECT COUNT(id), SUM(duration)/3600 FROM job '.$conditionstring;
|
my $query = 'SELECT COUNT(id), SUM(duration)/3600, SUM(duration*num_nodes)/3600 FROM job '.$conditionstring;
|
||||||
my ($count, $coreHours) = $dbh->selectrow_array($query);
|
my ($count, $walltime, $nodeHours) = $dbh->selectrow_array($query);
|
||||||
|
|
||||||
|
if ( $count > 0 ) {
|
||||||
print "=================================\n";
|
print "=================================\n";
|
||||||
print "Job count: $count\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';
|
$query = 'SELECT num_nodes, COUNT(*) FROM job '.$conditionstring.' GROUP BY 1';
|
||||||
my @histo_num_nodes = $dbh->selectall_array($query);
|
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';
|
$query = 'SELECT duration/3600, COUNT(*) FROM job '.$conditionstring.' GROUP BY 1';
|
||||||
my @histo_runtime = $dbh->selectall_array($query);
|
my @histo_runtime = $dbh->selectall_array($query);
|
||||||
print "\nHistogram: Runtime\n";
|
print "\nHistogram: Walltime\n";
|
||||||
print "hours\tcount\n";
|
print "hours\tcount\n";
|
||||||
|
|
||||||
foreach my $bin ( @histo_runtime ) {
|
foreach my $bin ( @histo_runtime ) {
|
||||||
print "$bin->[0]\t$bin->[1]\n";
|
print "$bin->[0]\t$bin->[1]\n";
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
print "No jobs\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user