From 814d16b54d2bfb4441d9f20d847057caccad0625 Mon Sep 17 00:00:00 2001 From: Pradyumna Kaushik Date: Fri, 10 Feb 2017 15:46:20 -0500 Subject: [PATCH] added hostmismatch function to be called by all schedulers --- utilities/offerUtils/offerUtils.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/utilities/offerUtils/offerUtils.go b/utilities/offerUtils/offerUtils.go index 16144dd..e1f6817 100644 --- a/utilities/offerUtils/offerUtils.go +++ b/utilities/offerUtils/offerUtils.go @@ -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 +}