From e7166420ddbe27013d84d7392db7e79758caf758 Mon Sep 17 00:00:00 2001 From: Pradyumna Kaushik Date: Sat, 28 Jan 2017 21:08:11 -0500 Subject: [PATCH] add function to determine PowerClass of host in offer. This was earlier to be written in each scheduler when using classMapWatts. --- utilities/offerUtils/offerUtils.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/utilities/offerUtils/offerUtils.go b/utilities/offerUtils/offerUtils.go index fc930f9..16144dd 100644 --- a/utilities/offerUtils/offerUtils.go +++ b/utilities/offerUtils/offerUtils.go @@ -21,6 +21,17 @@ func OfferAgg(offer *mesos.Offer) (float64, float64, float64) { 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 func (offersSorter OffersSorter) Len() int {