Sorting the tasks in non-decreasing order of watts for max-greedymins and max-min. Had unintentionally removed the sorting of tasks for max-greedymins and max-mins.

This commit is contained in:
Pradyumna Kaushik 2018-01-18 18:30:27 -05:00
parent 1b9442bf50
commit cb71153362
2 changed files with 12 additions and 6 deletions

View file

@ -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 {

View file

@ -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 {