Added option to run without taking watts
This commit is contained in:
parent
2575c2a20b
commit
e1e8a33e40
1 changed files with 7 additions and 0 deletions
|
@ -20,6 +20,7 @@ const (
|
||||||
var (
|
var (
|
||||||
defaultFilter = &mesos.Filters{RefuseSeconds: proto.Float64(1)}
|
defaultFilter = &mesos.Filters{RefuseSeconds: proto.Float64(1)}
|
||||||
longFilter = &mesos.Filters{RefuseSeconds: proto.Float64(1000)}
|
longFilter = &mesos.Filters{RefuseSeconds: proto.Float64(1000)}
|
||||||
|
IGNORE_WATTS = false
|
||||||
)
|
)
|
||||||
|
|
||||||
func CoLocated(tasks map[string]bool) {
|
func CoLocated(tasks map[string]bool) {
|
||||||
|
@ -53,6 +54,10 @@ func TakeOffer(offer *mesos.Offer, task Task) bool {
|
||||||
|
|
||||||
cpus, mem, watts := OfferAgg(offer)
|
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
|
//TODO: Insert watts calculation here instead of taking them as a parameter
|
||||||
|
|
||||||
if cpus >= task.CPU && mem >= task.RAM && watts >= task.Watts {
|
if cpus >= task.CPU && mem >= task.RAM && watts >= task.Watts {
|
||||||
|
@ -272,8 +277,10 @@ func (s *electronScheduler) Error(_ sched.SchedulerDriver, err string) {
|
||||||
func main() {
|
func main() {
|
||||||
master := flag.String("master", "xavier:5050", "Location of leading Mesos master")
|
master := flag.String("master", "xavier:5050", "Location of leading Mesos master")
|
||||||
tasksFile := flag.String("workload", "", "JSON file containing task definitions")
|
tasksFile := flag.String("workload", "", "JSON file containing task definitions")
|
||||||
|
ignoreWatts := flag.Bool("ignoreWatts", false, "Don't use watts from offers")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
IGNORE_WATTS = *ignoreWatts
|
||||||
|
|
||||||
if *tasksFile == "" {
|
if *tasksFile == "" {
|
||||||
fmt.Println("No file containing tasks specifiction provided.")
|
fmt.Println("No file containing tasks specifiction provided.")
|
||||||
|
|
Reference in a new issue