@@ -107,25 +107,26 @@ func (t *topologyPlugin) calcTreeAlocationData(job *podgroup_info.PodGroupInfo,
107
107
currentlyUpdatedDomains := map [TopologyDomainID ]* TopologyDomainInfo {}
108
108
for len (latestUpdatedDomains ) > 0 {
109
109
for _ , domain := range latestUpdatedDomains {
110
- if domain .Parent != nil {
111
- // Known issue: shold be replaced with the real distance logic
112
- // TODO: subsetsum on allocateablePods, from them find min distance
113
- if domain .Parent .AllocatablePods < taskToAllocateCount {
114
- // If the parent domain has less allocateable pods than the tasks to allocate,
115
- // we need to update the parent domain with the current domain's allocateable pods
116
- if domain .AllocatablePods < taskToAllocateCount {
117
- domain .Parent .Distance += domain .Distance
118
- domain .Parent .AllocatablePods += domain .AllocatablePods
119
- } else {
120
- domain .Parent .Distance = domain .Distance
121
- domain .Parent .AllocatablePods = domain .AllocatablePods
122
- }
123
- } else if domain .Parent .Distance > domain .Distance {
110
+ if domain .Parent == nil {
111
+ continue
112
+ }
113
+ // Known issue: should be replaced with the real distance logic
114
+ // TODO: subsetsum on allocateablePods, from them find min distance
115
+ if domain .Parent .AllocatablePods < taskToAllocateCount {
116
+ // If the parent domain has less allocateable pods than the tasks to allocate,
117
+ // we need to update the parent domain with the current domain's allocateable pods
118
+ if domain .AllocatablePods < taskToAllocateCount {
119
+ domain .Parent .Distance += domain .Distance
120
+ domain .Parent .AllocatablePods += domain .AllocatablePods
121
+ } else {
124
122
domain .Parent .Distance = domain .Distance
125
123
domain .Parent .AllocatablePods = domain .AllocatablePods
126
124
}
127
- currentlyUpdatedDomains [domain .Parent .ID ] = domain .Parent
125
+ } else if domain .Parent .Distance > domain .Distance {
126
+ domain .Parent .Distance = domain .Distance
127
+ domain .Parent .AllocatablePods = domain .AllocatablePods
128
128
}
129
+ currentlyUpdatedDomains [domain .Parent .ID ] = domain .Parent
129
130
}
130
131
latestUpdatedDomains = currentlyUpdatedDomains
131
132
currentlyUpdatedDomains = map [TopologyDomainID ]* TopologyDomainInfo {}
@@ -180,7 +181,7 @@ func (t *topologyPlugin) calcAllocationsForLeafDomains(job *podgroup_info.PodGro
180
181
{Name : "1-pods-resources" , ResReq : maxPodResources },
181
182
}
182
183
leafDomains := map [TopologyDomainID ]* TopologyDomainInfo {}
183
- for _ , node := range t .nodesInfoMap {
184
+ for _ , node := range t .nodesInfos {
184
185
allocateablePodsCount := calcNodeAccomedation (maxPodResources , allocationTestPods , node , len (tasksToAllocate ))
185
186
186
187
leafDomainId := calcLeafDomainId (topologyTree .TopologyResource , node .Node .Labels )
0 commit comments