capacity report in terms of offers and tasks
This commit is contained in:
parent
7ccb38f5e6
commit
b184c4c0d2
5 changed files with 912 additions and 1 deletions
20
util.go
20
util.go
|
@ -104,3 +104,23 @@ func calculateCurrentBatch(updatingInstances int32, batchSizes []int32) int {
|
|||
}
|
||||
return batchCount
|
||||
}
|
||||
|
||||
func ResourcesToMap(resources []*aurora.Resource) map[string]float64 {
|
||||
result := map[string]float64{}
|
||||
|
||||
for _, resource := range resources {
|
||||
if resource.NumCpus != nil {
|
||||
result["cpus"] += *resource.NumCpus
|
||||
} else if resource.RamMb != nil {
|
||||
result["mem"] += float64(*resource.RamMb)
|
||||
} else if resource.DiskMb != nil {
|
||||
result["disk"] += float64(*resource.DiskMb)
|
||||
} else if resource.NamedPort != nil {
|
||||
result["ports"]++
|
||||
} else if resource.NumGpus != nil {
|
||||
result["gpus"] += float64(*resource.NumGpus)
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue