Merged in resourceUsageTracking (pull request #2)
ResourceUsageTracking Approved-by: Akash Kothawale <akothaw1@binghamton.edu> Approved-by: Pradyumna Kaushik <pkaushi1@binghamton.edu>
This commit is contained in:
parent
ec18b617da
commit
6c77aa777e
3 changed files with 6 additions and 5 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,4 +0,0 @@
|
||||||
# Created by .ignore support plugin (hsz.mobi)
|
|
||||||
.idea/
|
|
||||||
# name of executable when built using command 'go build'
|
|
||||||
elektron
|
|
|
@ -3,7 +3,7 @@ package def
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/mdesenfants/gokmeans"
|
"github.com/mash/gokmeans"
|
||||||
"log"
|
"log"
|
||||||
"sort"
|
"sort"
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,6 +3,7 @@ package schedulers
|
||||||
import (
|
import (
|
||||||
"bitbucket.org/sunybingcloud/elektron/def"
|
"bitbucket.org/sunybingcloud/elektron/def"
|
||||||
elecLogDef "bitbucket.org/sunybingcloud/elektron/logging/def"
|
elecLogDef "bitbucket.org/sunybingcloud/elektron/logging/def"
|
||||||
|
"bitbucket.org/sunybingcloud/elektron/utilities"
|
||||||
"bitbucket.org/sunybingcloud/elektron/utilities/schedUtils"
|
"bitbucket.org/sunybingcloud/elektron/utilities/schedUtils"
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
@ -187,6 +188,7 @@ func (s *BaseScheduler) Disconnected(sched.SchedulerDriver) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *BaseScheduler) ResourceOffers(driver sched.SchedulerDriver, offers []*mesos.Offer) {
|
func (s *BaseScheduler) ResourceOffers(driver sched.SchedulerDriver, offers []*mesos.Offer) {
|
||||||
|
utilities.RecordTotalResourceAvailability(offers)
|
||||||
for _, offer := range offers {
|
for _, offer := range offers {
|
||||||
if _, ok := s.HostNameToSlaveID[offer.GetHostname()]; !ok {
|
if _, ok := s.HostNameToSlaveID[offer.GetHostname()]; !ok {
|
||||||
s.HostNameToSlaveID[offer.GetHostname()] = offer.GetSlaveId().GoString()
|
s.HostNameToSlaveID[offer.GetHostname()] = offer.GetSlaveId().GoString()
|
||||||
|
@ -212,6 +214,9 @@ func (s *BaseScheduler) StatusUpdate(driver sched.SchedulerDriver, status *mesos
|
||||||
if *status.State == mesos.TaskState_TASK_RUNNING {
|
if *status.State == mesos.TaskState_TASK_RUNNING {
|
||||||
s.tasksRunning++
|
s.tasksRunning++
|
||||||
} else if IsTerminal(status.State) {
|
} else if IsTerminal(status.State) {
|
||||||
|
// Update resource availability.
|
||||||
|
utilities.ResourceAvailabilityUpdate("ON_TASK_TERMINAL_STATE",
|
||||||
|
*status.TaskId, *status.SlaveId)
|
||||||
s.TasksRunningMutex.Lock()
|
s.TasksRunningMutex.Lock()
|
||||||
delete(s.Running[status.GetSlaveId().GoString()], *status.TaskId.Value)
|
delete(s.Running[status.GetSlaveId().GoString()], *status.TaskId.Value)
|
||||||
s.TasksRunningMutex.Unlock()
|
s.TasksRunningMutex.Unlock()
|
||||||
|
|
Reference in a new issue