mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-26 05:19:05 +01:00
add check on returned stats
This commit is contained in:
parent
a8eff6fbd1
commit
5f4a74f8ba
@ -79,10 +79,16 @@ func RegisterFootprintWorker() {
|
|||||||
for metric, data := range jobStats { // Metric, Hostname:Stats
|
for metric, data := range jobStats { // Metric, Hostname:Stats
|
||||||
avg, min, max := 0.0, math.MaxFloat32, -math.MaxFloat32
|
avg, min, max := 0.0, math.MaxFloat32, -math.MaxFloat32
|
||||||
|
|
||||||
for _, hostStats := range data {
|
for hostname := range data {
|
||||||
avg += hostStats.Avg
|
hostStats, ok := data[hostname]
|
||||||
min = math.Min(min, hostStats.Min)
|
if !ok {
|
||||||
max = math.Max(max, hostStats.Max)
|
log.Debugf("footprintWorker: NAN stats returned for job %d @ %s", job.JobID, hostname)
|
||||||
|
} else {
|
||||||
|
log.Debugf("stats returned for job %d : %#v", job.JobID, hostStats)
|
||||||
|
avg += hostStats.Avg
|
||||||
|
min = math.Min(min, hostStats.Min)
|
||||||
|
max = math.Max(max, hostStats.Max)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add values rounded to 2 digits
|
// Add values rounded to 2 digits
|
||||||
|
Loading…
Reference in New Issue
Block a user