Skip to content

Commit

Permalink
format the code to match CI
Browse files Browse the repository at this point in the history
Signed-off-by: Thor-wl <13164644535@163.com>
  • Loading branch information
Thor-wl committed Apr 16, 2022
1 parent 56d6dcd commit 1d06117
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 47 deletions.
2 changes: 1 addition & 1 deletion pkg/scheduler/actions/preempt/preempt.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ func victimTasks(ssn *framework.Session) {
tasks := make([]*api.TaskInfo, 0)
victimTasksMap := ssn.VictimTasks(tasks)
victimTasks := make([]*api.TaskInfo, 0)
for task, _ := range victimTasksMap {
for task := range victimTasksMap {
victimTasks = append(victimTasks, task)
}
for _, victim := range victimTasks {
Expand Down
5 changes: 2 additions & 3 deletions pkg/scheduler/actions/shuffle/fake_plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,12 @@ func (fp *fakePlugin) Name() string {
}

func (fp *fakePlugin) OnSessionOpen(ssn *framework.Session) {
var lowPriority int32
lowPriority = 10
lowPriority := 10

victimTasksFn := func(candidates []*api.TaskInfo) []*api.TaskInfo {
evicts := make([]*api.TaskInfo, 0)
for _, task := range candidates {
if task.Priority == lowPriority {
if task.Priority == int32(lowPriority) {
evicts = append(evicts, task)
}
}
Expand Down
1 change: 1 addition & 0 deletions pkg/scheduler/actions/shuffle/shuffle.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
)

const (
// Shuffle Shffle indicates the action name
Shuffle = "shuffle"
)

Expand Down
43 changes: 0 additions & 43 deletions pkg/scheduler/framework/session_plugins.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,49 +443,6 @@ func (ssn *Session) TargetJob(jobs []*api.JobInfo) *api.JobInfo {
return nil
}

// VictimTasks invoke ReservedNodes function of the plugins
//func (ssn *Session) VictimTasks() []*api.TaskInfo {
// var victims []*api.TaskInfo
// var init bool
//
// for _, tier := range ssn.Tiers {
// for _, plugin := range tier.Plugins {
// if !isEnabled(plugin.EnabledVictim) {
// continue
// }
//
// pf, found := ssn.victimTasksFns[plugin.Name]
// if !found {
// continue
// }
// candidates := pf()
// if !init {
// victims = candidates
// init = true
// } else {
// var intersection []*api.TaskInfo
// // Get intersection of victims and candidates.
// for _, v := range victims {
// for _, c := range candidates {
// if v.UID == c.UID {
// intersection = append(intersection, v)
// }
// }
// }
//
// // Update victims to intersection
// victims = intersection
// }
// }
// // Plugins in this tier made decision if victims is not nil
// if victims != nil {
// return victims
// }
// }
//
// return victims
//}

// VictimTasks returns the victims selected
func (ssn *Session) VictimTasks(tasks []*api.TaskInfo) map[*api.TaskInfo]bool {
// different filters may add the same task to victims, so use a map to remove duplicate tasks.
Expand Down

0 comments on commit 1d06117

Please sign in to comment.