Scheduler Reduce function can use nodeNameToNodeInfo map

pull/6/head
gmarek 2016-10-26 15:14:38 +02:00
parent 7a49b0eb77
commit 3971553298
5 changed files with 5 additions and 5 deletions

View File

@ -78,7 +78,7 @@ func CalculateNodeAffinityPriorityMap(pod *api.Pod, meta interface{}, nodeInfo *
}, nil
}
func CalculateNodeAffinityPriorityReduce(pod *api.Pod, meta interface{}, result schedulerapi.HostPriorityList) error {
func CalculateNodeAffinityPriorityReduce(pod *api.Pod, meta interface{}, nodeNameToInfo map[string]*schedulercache.NodeInfo, result schedulerapi.HostPriorityList) error {
var maxCount int
for i := range result {
if result[i].Score > maxCount {

View File

@ -88,7 +88,7 @@ func ComputeTaintTolerationPriorityMap(pod *api.Pod, meta interface{}, nodeInfo
}, nil
}
func ComputeTaintTolerationPriorityReduce(pod *api.Pod, meta interface{}, result schedulerapi.HostPriorityList) error {
func ComputeTaintTolerationPriorityReduce(pod *api.Pod, meta interface{}, nodeNameToInfo map[string]*schedulercache.NodeInfo, result schedulerapi.HostPriorityList) error {
var maxCount int
for i := range result {
if result[i].Score > maxCount {

View File

@ -51,7 +51,7 @@ func priorityFunction(mapFn algorithm.PriorityMapFunction, reduceFn algorithm.Pr
result = append(result, hostResult)
}
if reduceFn != nil {
if err := reduceFn(pod, nil, result); err != nil {
if err := reduceFn(pod, nil, nodeNameToInfo, result); err != nil {
return nil, err
}
}

View File

@ -36,7 +36,7 @@ type PriorityMapFunction func(pod *api.Pod, meta interface{}, nodeInfo *schedule
// final scores for all nodes.
// TODO: Figure out the exact API of this method.
// TODO: Change interface{} to a specific type.
type PriorityReduceFunction func(pod *api.Pod, meta interface{}, result schedulerapi.HostPriorityList) error
type PriorityReduceFunction func(pod *api.Pod, meta interface{}, nodeNameToInfo map[string]*schedulercache.NodeInfo, result schedulerapi.HostPriorityList) error
// MetdataProducer is a function that computes metadata for a given pod.
type MetadataProducer func(pod *api.Pod, nodeNameToInfo map[string]*schedulercache.NodeInfo) interface{}

View File

@ -315,7 +315,7 @@ func PrioritizeNodes(
wg.Add(1)
go func(index int, config algorithm.PriorityConfig) {
defer wg.Done()
if err := config.Reduce(pod, meta, results[index]); err != nil {
if err := config.Reduce(pod, meta, nodeNameToInfo, results[index]); err != nil {
appendError(err)
}
}(i, priorityConfig)