Refactor Priority Reduce functions

- Reducing the duplicated reduce function by introducing a reduce
  function generator that generates common reduce functions.
- Remove logs from reduce function, so it's purely calculating scores.
- Optimize the reduce functions by removing unnecessary conversion to
  float64.
This commit is contained in:
Yongkun Anfernee Gui
2017-11-07 11:34:20 -08:00
parent 45bdf707f0
commit 4be6a60df2
7 changed files with 75 additions and 52 deletions

View File

@@ -433,6 +433,11 @@ func PrioritizeNodes(
if err := config.Reduce(pod, meta, nodeNameToInfo, results[index]); err != nil {
appendError(err)
}
if glog.V(10) {
for _, hostPriority := range results[index] {
glog.Infof("%v -> %v: %v, Score: (%d)", pod.Name, hostPriority.Host, config.Name, hostPriority.Score)
}
}
}(i, priorityConfig)
}
// Wait for all computations to be finished.