mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-26 21:39:06 +01:00
expand check, change to zero init
This commit is contained in:
parent
5f4a74f8ba
commit
00ddc462d2
@ -76,19 +76,21 @@ func RegisterFootprintWorker() {
|
|||||||
Statistics: make(map[string]schema.JobStatistics),
|
Statistics: make(map[string]schema.JobStatistics),
|
||||||
}
|
}
|
||||||
|
|
||||||
for metric, data := range jobStats { // Metric, Hostname:Stats
|
for metric := range jobStats { // Metric, Hostname:Stats
|
||||||
avg, min, max := 0.0, math.MaxFloat32, -math.MaxFloat32
|
avg, min, max := 0.0, 0.0, 0.0 // math.MaxFloat32, -math.MaxFloat32
|
||||||
|
|
||||||
for hostname := range data {
|
data, ok := jobStats[metric]
|
||||||
hostStats, ok := data[hostname]
|
if ok {
|
||||||
if !ok {
|
for hostname := range data {
|
||||||
log.Debugf("footprintWorker: NAN stats returned for job %d @ %s", job.JobID, hostname)
|
hostStats, ok := data[hostname]
|
||||||
} else {
|
if ok {
|
||||||
log.Debugf("stats returned for job %d : %#v", job.JobID, hostStats)
|
avg += hostStats.Avg
|
||||||
avg += hostStats.Avg
|
min = math.Min(min, hostStats.Min)
|
||||||
min = math.Min(min, hostStats.Min)
|
max = math.Max(max, hostStats.Max)
|
||||||
max = math.Max(max, hostStats.Max)
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log.Debugf("no stats data return for job %d, metric %s", job.JobID, metric)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add values rounded to 2 digits
|
// Add values rounded to 2 digits
|
||||||
|
Loading…
Reference in New Issue
Block a user