|
@@ -220,7 +220,9 @@ func (g *genericScheduler) Schedule(pod *v1.Pod, nodeLister algorithm.NodeLister
|
|
|
metrics.SchedulingLatency.WithLabelValues(metrics.PredicateEvaluation).Observe(metrics.SinceInSeconds(startPredicateEvalTime))
|
|
|
metrics.DeprecatedSchedulingLatency.WithLabelValues(metrics.PredicateEvaluation).Observe(metrics.SinceInSeconds(startPredicateEvalTime))
|
|
|
|
|
|
- trace.Step("Prioritizing")
|
|
|
+ //trace.Step("Prioritizing")
|
|
|
+ trace.Step("Prioritizing Sockets")
|
|
|
+
|
|
|
startPriorityEvalTime := time.Now()
|
|
|
// When only one node after predicate, just use it.
|
|
|
if len(filteredNodes) == 1 {
|
|
@@ -234,8 +236,22 @@ func (g *genericScheduler) Schedule(pod *v1.Pod, nodeLister algorithm.NodeLister
|
|
|
}
|
|
|
|
|
|
metaPrioritiesInterface := g.priorityMetaProducer(pod, g.nodeInfoSnapshot.NodeInfoMap)
|
|
|
- priorityList, err := PrioritizeNodes(pod, g.nodeInfoSnapshot.NodeInfoMap, metaPrioritiesInterface, g.prioritizers, filteredNodes, g.extenders)
|
|
|
- //priorityList, err := CustomPrioritizeNodes(pod, g.nodeInfoSnapshot.NodeInfoMap, metaPrioritiesInterface, g.prioritizers, filteredNodes, g.extenders)
|
|
|
+
|
|
|
+ // default
|
|
|
+ //priorityList, err := PrioritizeNodes(pod, g.nodeInfoSnapshot.NodeInfoMap, metaPrioritiesInterface, g.prioritizers, filteredNodes, g.extenders)
|
|
|
+ // default
|
|
|
+
|
|
|
+ //start-custom
|
|
|
+ socketPrioritizers := []priorities.PriorityConfig{
|
|
|
+ {
|
|
|
+ Name: priorities.CustomRequestedPriority,
|
|
|
+ Map: priorities.CustomRequestedPriorityMap,
|
|
|
+ Weight: 100,
|
|
|
+ },
|
|
|
+ }
|
|
|
+
|
|
|
+ priorityList, err := PrioritizeNodes(pod, g.nodeInfoSnapshot.NodeInfoMap, metaPrioritiesInterface, socketPrioritizers, filteredNodes, g.extenders)
|
|
|
+ //end-custom
|
|
|
if err != nil {
|
|
|
return result, err
|
|
|
}
|
|
@@ -244,9 +260,34 @@ func (g *genericScheduler) Schedule(pod *v1.Pod, nodeLister algorithm.NodeLister
|
|
|
metrics.SchedulingLatency.WithLabelValues(metrics.PriorityEvaluation).Observe(metrics.SinceInSeconds(startPriorityEvalTime))
|
|
|
metrics.DeprecatedSchedulingLatency.WithLabelValues(metrics.PriorityEvaluation).Observe(metrics.SinceInSeconds(startPriorityEvalTime))
|
|
|
|
|
|
+ // -----------------------------------------------------
|
|
|
+ // ------------------START-CUSTOM-----------------------
|
|
|
+ // -----------------------------------------------------
|
|
|
+ trace.Step("Selecting socket")
|
|
|
+ hosts, err := g.selectHostOnWinningSocket(priorityList)
|
|
|
+
|
|
|
+ //declare a subset of the snapshot of all available nodes
|
|
|
+ // create a new map, containing only the subset of the nodes
|
|
|
+ //var winningSocketNodes map[string]*schedulernodeinfo.NodeInfo
|
|
|
+ var winningSocketNodes []*v1.Node
|
|
|
+
|
|
|
+ for _, wn := range hosts {
|
|
|
+ for _, n := range filteredNodes {
|
|
|
+ if n.Name == wn {
|
|
|
+ winningSocketNodes = append(winningSocketNodes, n)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ priorityList, err = PrioritizeNodes(pod, g.nodeInfoSnapshot.NodeInfoMap, metaPrioritiesInterface, g.prioritizers, winningSocketNodes, g.extenders)
|
|
|
+
|
|
|
+ // -----------------------------------------------------
|
|
|
+ // ------------------END-CUSTOM-----------------------
|
|
|
+ // -----------------------------------------------------
|
|
|
trace.Step("Selecting host")
|
|
|
|
|
|
host, err := g.selectHost(priorityList)
|
|
|
+
|
|
|
return ScheduleResult{
|
|
|
SuggestedHost: host,
|
|
|
EvaluatedNodes: len(filteredNodes) + len(failedPredicateMap),
|
|
@@ -301,6 +342,24 @@ func (g *genericScheduler) selectHost(priorityList schedulerapi.HostPriorityList
|
|
|
// ---------START OF CUSTOMIZATION----------------------------------------------------------------
|
|
|
//------------------------------------------------------------------------------------------------
|
|
|
//------------------------------------------------------------------------------------------------
|
|
|
+
|
|
|
+// 1st level of filtering
|
|
|
+// returns a list of nodes that belong to the winning socket
|
|
|
+func (g *genericScheduler) selectHostOnWinningSocket(priorityList schedulerapi.HostPriorityList) ([]string, error) {
|
|
|
+ var res []string
|
|
|
+ if len(priorityList) == 0 {
|
|
|
+ return res, fmt.Errorf("empty priorityList")
|
|
|
+ }
|
|
|
+
|
|
|
+ maxScores := findMaxScores(priorityList)
|
|
|
+ //ix := int(g.lastNodeIndex % uint64(len(maxScores)))
|
|
|
+ g.lastNodeIndex++
|
|
|
+ for _, idx := range maxScores {
|
|
|
+ res = append(res, priorityList[idx].Host)
|
|
|
+ }
|
|
|
+ return res, nil
|
|
|
+}
|
|
|
+
|
|
|
// func (g *genericScheduler) customSelectHost(priorityList schedulerapi.CustomHostPriorityList) (string, error) {
|
|
|
// if len(priorityList) == 0 {
|
|
|
// return "", fmt.Errorf("empty priorityList")
|
|
@@ -744,6 +803,7 @@ func PrioritizeNodes(
|
|
|
workqueue.ParallelizeUntil(context.TODO(), 16, len(nodes), func(index int) {
|
|
|
nodeInfo := nodeNameToInfo[nodes[index].Name]
|
|
|
for i := range priorityConfigs {
|
|
|
+ // The Function is nil if there is no Map-Reduce functionality provided
|
|
|
if priorityConfigs[i].Function != nil {
|
|
|
continue
|
|
|
}
|