diff --git a/schedulers/max-greedymins.go b/schedulers/max-greedymins.go index b572e73..57d8763 100644 --- a/schedulers/max-greedymins.go +++ b/schedulers/max-greedymins.go @@ -1,16 +1,17 @@ package schedulers import ( + "fmt" + "log" + "time" + "bitbucket.org/sunybingcloud/elektron/def" "bitbucket.org/sunybingcloud/elektron/utilities/mesosUtils" "bitbucket.org/sunybingcloud/elektron/utilities/offerUtils" - "fmt" "github.com/golang/protobuf/proto" mesos "github.com/mesos/mesos-go/mesosproto" "github.com/mesos/mesos-go/mesosutil" sched "github.com/mesos/mesos-go/scheduler" - "log" - "time" ) // Decides if to take an offer or not. @@ -40,6 +41,8 @@ type MaxGreedyMins struct { // Initialization. func (s *MaxGreedyMins) init(opts ...schedPolicyOption) { s.base.init(opts...) + // Sorting the tasks based on watts. + def.SortTasks(s.tasks, def.SortByWatts) } func (s *MaxGreedyMins) newTask(offer *mesos.Offer, task def.Task) *mesos.TaskInfo { diff --git a/schedulers/max-min.go b/schedulers/max-min.go index cd8a4ad..dd77607 100644 --- a/schedulers/max-min.go +++ b/schedulers/max-min.go @@ -1,16 +1,17 @@ package schedulers import ( + "fmt" + "log" + "time" + "bitbucket.org/sunybingcloud/elektron/def" "bitbucket.org/sunybingcloud/elektron/utilities/mesosUtils" "bitbucket.org/sunybingcloud/elektron/utilities/offerUtils" - "fmt" "github.com/golang/protobuf/proto" mesos "github.com/mesos/mesos-go/mesosproto" "github.com/mesos/mesos-go/mesosutil" sched "github.com/mesos/mesos-go/scheduler" - "log" - "time" ) // Decides if to take an offer or not. @@ -40,6 +41,8 @@ type MaxMin struct { // Initialization. func (s *MaxMin) init(opts ...schedPolicyOption) { s.base.init(opts...) + // Sorting the tasks based on Watts. + def.SortTasks(s.tasks, def.SortByWatts) } func (s *MaxMin) newTask(offer *mesos.Offer, task def.Task) *mesos.TaskInfo {