Skip to content
This repository was archived by the owner on Jun 1, 2021. It is now read-only.

Commit

Permalink
Merged in resourceUsageTracking (pull request #2)
Browse files Browse the repository at this point in the history
ResourceUsageTracking

Approved-by: Akash Kothawale <[email protected]>
Approved-by: Pradyumna Kaushik <[email protected]>
  • Loading branch information
pradykaushik committed Sep 23, 2018
1 parent ec18b61 commit 6c77aa7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 0 additions & 4 deletions .gitignore

This file was deleted.

2 changes: 1 addition & 1 deletion def/taskUtils.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package def
import (
"errors"
"fmt"
"github.com/mdesenfants/gokmeans"
"github.com/mash/gokmeans"
"log"
"sort"
)
Expand Down
5 changes: 5 additions & 0 deletions schedulers/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package schedulers
import (
"bitbucket.org/sunybingcloud/elektron/def"
elecLogDef "bitbucket.org/sunybingcloud/elektron/logging/def"
"bitbucket.org/sunybingcloud/elektron/utilities"
"bitbucket.org/sunybingcloud/elektron/utilities/schedUtils"
"bytes"
"fmt"
Expand Down Expand Up @@ -187,6 +188,7 @@ func (s *BaseScheduler) Disconnected(sched.SchedulerDriver) {
}

func (s *BaseScheduler) ResourceOffers(driver sched.SchedulerDriver, offers []*mesos.Offer) {
utilities.RecordTotalResourceAvailability(offers)
for _, offer := range offers {
if _, ok := s.HostNameToSlaveID[offer.GetHostname()]; !ok {
s.HostNameToSlaveID[offer.GetHostname()] = offer.GetSlaveId().GoString()
Expand All @@ -212,6 +214,9 @@ func (s *BaseScheduler) StatusUpdate(driver sched.SchedulerDriver, status *mesos
if *status.State == mesos.TaskState_TASK_RUNNING {
s.tasksRunning++
} else if IsTerminal(status.State) {
// Update resource availability.
utilities.ResourceAvailabilityUpdate("ON_TASK_TERMINAL_STATE",
*status.TaskId, *status.SlaveId)
s.TasksRunningMutex.Lock()
delete(s.Running[status.GetSlaveId().GoString()], *status.TaskId.Value)
s.TasksRunningMutex.Unlock()
Expand Down

0 comments on commit 6c77aa7

Please sign in to comment.