added hostmismatch function to be called by all schedulers

This commit is contained in:
Pradyumna Kaushik 2017-02-10 15:46:20 -05:00
parent 57512ac2dd
commit 814d16b54d

View file

@ -2,6 +2,7 @@ package offerUtils
import (
mesos "github.com/mesos/mesos-go/mesosproto"
"strings"
)
func OfferAgg(offer *mesos.Offer) (float64, float64, float64) {
@ -49,3 +50,11 @@ func (offersSorter OffersSorter) Less(i, j int) bool {
cpu2, _, _ := OfferAgg(offersSorter[j])
return cpu1 <= cpu2
}
// Is there a mismatch between the task's host requirement and the host corresponding to the offer.
func HostMismatch(offerHost string, taskHost string) bool {
if taskHost != "" && !strings.HasPrefix(offerHost, taskHost) {
return true
}
return false
}