Merged in scheduleOnlySchedWindowTasks (pull request #6)

ScheduleOnlySchedWindowTasks

Approved-by: Akash Kothawale <akothaw1@binghamton.edu>
This commit is contained in:
Pradyumna Kaushik 2018-02-16 21:49:12 +00:00
parent 3d51efc679
commit 85383da550
10 changed files with 103 additions and 112 deletions

View file

@ -1,7 +1,7 @@
package def
// The sortBy function that takes a task reference and returns the resource to consider when sorting.
type sortBy func(task *Task) float64
// the sortBy function that takes a task reference and returns the resource to consider when sorting.
type SortBy func(task *Task) float64
// Possible Sorting Criteria.
// Each holds a closure that fetches the required resource from the

View file

@ -119,7 +119,7 @@ func labelAndOrder(clusters map[int][]Task, numberOfClusters int, taskObservatio
// Generic Task Sorter.
// Be able to sort an array of tasks based on any of the tasks' resources.
func SortTasks(ts []Task, sb sortBy) {
func SortTasks(ts []Task, sb SortBy) {
sort.SliceStable(ts, func(i, j int) bool {
return sb(&ts[i]) <= sb(&ts[j])
})