You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/batch.volcano.sh/v1alpha1/Job/customizations.yaml
+67-5Lines changed: 67 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -110,10 +110,29 @@ spec:
110
110
return nil
111
111
end
112
112
end
113
+
113
114
function AggregateStatus(desiredObj, statusItems)
114
115
if statusItems == nil then return desiredObj end
115
116
if desiredObj.status == nil then desiredObj.status = {} end
116
-
117
+
118
+
if #statusItems == 1 then
119
+
desiredObj.status = statusItems[1].status
120
+
return desiredObj
121
+
end
122
+
123
+
local failedClusters = {}
124
+
local completedClusters = 0
125
+
local latestTransition = {}
126
+
local successfulClusters = 0
127
+
local hasFailed = false
128
+
local failedConditions = {}
129
+
local failedPhases = {
130
+
Failed = true,
131
+
Aborted = true,
132
+
Aborting = true,
133
+
Terminated = true,
134
+
Terminating = true,
135
+
}
117
136
local status = {
118
137
state = {},
119
138
minAvailable = 0,
@@ -129,7 +148,6 @@ spec:
129
148
controlledResources = {},
130
149
conditions = {},
131
150
runningDuration = "0s",
132
-
state = {}
133
151
}
134
152
135
153
for i = 1, #statusItems do
@@ -144,7 +162,6 @@ spec:
144
162
status.unknown = status.unknown + (s.unknown or 0)
145
163
status.version = math.max(status.version, s.version or 0)
146
164
status.retryCount = status.retryCount + (s.retryCount or 0)
147
-
status.state = s.state
148
165
if durationVal(s.runningDuration) > durationVal(status.runningDuration) then
149
166
status.runningDuration = s.runningDuration
150
167
end
@@ -161,17 +178,62 @@ spec:
161
178
end
162
179
end
163
180
end
181
+
164
182
if s.controlledResources then
165
183
for k, v in pairs(s.controlledResources) do
166
184
status.controlledResources[k] = v
167
185
end
168
186
end
169
187
170
-
if s.conditions ~= nil then
188
+
if s.conditions then
189
+
local clusterHasFailed = false
171
190
for _, c in ipairs(s.conditions) do
172
-
table.insert(status.conditions, c)
191
+
if failedPhases[c.status] then
192
+
clusterHasFailed = true
193
+
hasFailed = true
194
+
end
195
+
if not clusterHasFailed then
196
+
local exist = latestTransition[c.status]
197
+
if exist == nil or c.lastTransitionTime > exist.lastTransitionTime then
198
+
latestTransition[c.status] = c
199
+
end
200
+
end
201
+
end
202
+
if clusterHasFailed and #failedConditions == 0 then
203
+
failedConditions = s.conditions
173
204
end
174
205
end
206
+
207
+
if s.state ~= nil then
208
+
local st = s.state
209
+
if st.phase == "Completed" then
210
+
successfulClusters = successfulClusters + 1
211
+
elseif st.phase == "Failed" or st.phase == "Aborted" then
0 commit comments