From e1e8a33e406e31c62cd001af888cac98e5d53bbb Mon Sep 17 00:00:00 2001 From: Renan DelValle Date: Mon, 26 Sep 2016 19:29:30 -0400 Subject: [PATCH] Added option to run without taking watts --- scheduler.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scheduler.go b/scheduler.go index 5b0e080..9735291 100644 --- a/scheduler.go +++ b/scheduler.go @@ -20,6 +20,7 @@ const ( var ( defaultFilter = &mesos.Filters{RefuseSeconds: proto.Float64(1)} longFilter = &mesos.Filters{RefuseSeconds: proto.Float64(1000)} + IGNORE_WATTS = false ) func CoLocated(tasks map[string]bool) { @@ -53,6 +54,10 @@ func TakeOffer(offer *mesos.Offer, task Task) bool { cpus, mem, watts := OfferAgg(offer) + if(IGNORE_WATTS) { + task.Watts = 0.0 // Don't take any watts in the offer + } + //TODO: Insert watts calculation here instead of taking them as a parameter if cpus >= task.CPU && mem >= task.RAM && watts >= task.Watts { @@ -272,8 +277,10 @@ func (s *electronScheduler) Error(_ sched.SchedulerDriver, err string) { func main() { master := flag.String("master", "xavier:5050", "Location of leading Mesos master") tasksFile := flag.String("workload", "", "JSON file containing task definitions") + ignoreWatts := flag.Bool("ignoreWatts", false, "Don't use watts from offers") flag.Parse() + IGNORE_WATTS = *ignoreWatts if *tasksFile == "" { fmt.Println("No file containing tasks specifiction provided.")