added hostmismatch function to be called by all schedulers
This commit is contained in:
parent
57512ac2dd
commit
814d16b54d
1 changed files with 9 additions and 0 deletions
|
@ -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
|
||||
}
|
||||
|
|
Reference in a new issue