add function to determine PowerClass of host in offer. This was earlier to be written in each scheduler when using classMapWatts.
This commit is contained in:
parent
5128c51b22
commit
e7166420dd
1 changed files with 11 additions and 0 deletions
|
@ -21,6 +21,17 @@ func OfferAgg(offer *mesos.Offer) (float64, float64, float64) {
|
||||||
return cpus, mem, watts
|
return cpus, mem, watts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Determine the power class of the host in the offer
|
||||||
|
func PowerClass(offer *mesos.Offer) string {
|
||||||
|
var powerClass string
|
||||||
|
for _, attr := range offer.GetAttributes() {
|
||||||
|
if attr.GetName() == "class" {
|
||||||
|
powerClass = attr.GetText().GetValue()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return powerClass
|
||||||
|
}
|
||||||
|
|
||||||
type OffersSorter []*mesos.Offer
|
type OffersSorter []*mesos.Offer
|
||||||
|
|
||||||
func (offersSorter OffersSorter) Len() int {
|
func (offersSorter OffersSorter) Len() int {
|
||||||
|
|
Reference in a new issue