Commit 612b3c9b authored by Bobby (Babak) Salamat's avatar Bobby (Babak) Salamat

Run old-style priority functions in parallel to the map-reduce style ones

parent a2e74f28
...@@ -655,19 +655,21 @@ func PrioritizeNodes( ...@@ -655,19 +655,21 @@ func PrioritizeNodes(
// DEPRECATED: we can remove this when all priorityConfigs implement the // DEPRECATED: we can remove this when all priorityConfigs implement the
// Map-Reduce pattern. // Map-Reduce pattern.
workqueue.ParallelizeUntil(context.TODO(), 16, len(priorityConfigs), func(i int) { for i := range priorityConfigs {
priorityConfig := priorityConfigs[i] if priorityConfigs[i].Function != nil {
if priorityConfig.Function == nil { wg.Add(1)
go func(index int) {
defer wg.Done()
var err error
results[index], err = priorityConfigs[index].Function(pod, nodeNameToInfo, nodes)
if err != nil {
appendError(err)
}
}(i)
} else {
results[i] = make(schedulerapi.HostPriorityList, len(nodes)) results[i] = make(schedulerapi.HostPriorityList, len(nodes))
return
}
var err error
results[i], err = priorityConfig.Function(pod, nodeNameToInfo, nodes)
if err != nil {
appendError(err)
} }
}) }
workqueue.ParallelizeUntil(context.TODO(), 16, len(nodes), func(index int) { workqueue.ParallelizeUntil(context.TODO(), 16, len(nodes), func(index int) {
nodeInfo := nodeNameToInfo[nodes[index].Name] nodeInfo := nodeNameToInfo[nodes[index].Name]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment