changed def.TaskSorter(...) to def.SortTasks(...) for semantics. Now, def.SortTasks(...) also sorts the tasks instead of returning just a func (i, j int) bool {}. Removed TODO from the README associated with this PR
This commit is contained in:
parent
0869bea2d8
commit
9e620eaede
2 changed files with 3 additions and 5 deletions
|
@ -16,7 +16,6 @@ To Do:
|
|||
* Have a centralised logFile that can be filtered by identifier. All electron logs should go into this file.
|
||||
* Make def.Task an interface for further modularization and flexibility.
|
||||
* Convert def#WattsToConsider(...) to be a receiver of def.Task and change the name of it to Watts(...).
|
||||
* Have a generic sorter for task resources instead of having one for each kind of resource.
|
||||
* **Critical** -- Add software requirements to the README.md (Mesos version, RAPL version, PCP version, Go version...)
|
||||
* **Critical** -- Retrofit to use Go 1.8 sorting techniques. Use def/taskUtils.go for reference.
|
||||
* Handle powerclass not configured on a node condition. As of now, an assumption is made that the powerclass is configured
|
||||
|
|
|
@ -119,9 +119,8 @@ func labelAndOrder(clusters map[int][]Task, numberOfClusters int, taskObservatio
|
|||
// Be able to sort an array of tasks based on any of the tasks' resources.
|
||||
|
||||
// Retrieve a sorter (same signature as 'Less' function in sort.Interface) for the given sorting criteria.
|
||||
type TasksToSort []Task
|
||||
func (ts TasksToSort) TaskSorter(sb sortBy) func (i, j int) bool {
|
||||
return func (i, j int) bool {
|
||||
func SortTasks(ts []Task, sb sortBy) {
|
||||
sort.SliceStable(ts, func (i, j int) bool {
|
||||
return sb(&ts[i]) <= sb(&ts[j])
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Reference in a new issue