mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-26 13:29:05 +01:00
Add walltime and node core hours.
Improve error handling.
This commit is contained in:
parent
c92ebc4149
commit
f7927ed297
41
acQuery.pl
41
acQuery.pl
@ -152,29 +152,34 @@ 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);
|
||||||
|
|
||||||
print "=================================\n";
|
if ( $count > 0 ) {
|
||||||
print "Job count: $count\n";
|
print "=================================\n";
|
||||||
print "Core hours: $coreHours \n";
|
print "Job count: $count\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);
|
||||||
print "\nHistogram: Number of nodes\n";
|
print "\nHistogram: Number of nodes\n";
|
||||||
print "nodes\tcount\n";
|
print "nodes\tcount\n";
|
||||||
|
|
||||||
foreach my $bin ( @histo_num_nodes ) {
|
foreach my $bin ( @histo_num_nodes ) {
|
||||||
print "$bin->[0]\t$bin->[1]\n";
|
print "$bin->[0]\t$bin->[1]\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$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