Skip to content

Commit cd0c284

Browse files
committed
remove unused code
1 parent 8435da3 commit cd0c284

File tree

1 file changed

+14
-8
lines changed
  • pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/PyTorchJob

1 file changed

+14
-8
lines changed

pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/PyTorchJob/customizations.yaml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,12 @@ spec:
4343
local components = {}
4444
4545
-- Master Component
46-
local master_replicas = to_num(get(observedObj, {"spec", "pytorchReplicaSpecs", "Master", "replicas"}), 1)
47-
local master_template = get(observedObj, {"spec", "pytorchReplicaSpecs", "Master", "template"})
46+
local master_spec = get(observedObj, {"spec", "pytorchReplicaSpecs", "Master"})
47+
if master_spec == nil then
48+
return components
49+
end
50+
local master_replicas = to_num(master_spec.replicas, 1)
51+
local master_template = master_spec.template
4852
4953
local master_requires = {}
5054
if master_template ~= nil then
@@ -59,8 +63,12 @@ spec:
5963
table.insert(components, masterComponent)
6064
6165
-- Worker Component
62-
local worker_replicas = to_num(get(observedObj, {"spec", "pytorchReplicaSpecs", "Worker", "replicas"}), 1)
63-
local worker_template = get(observedObj, {"spec", "pytorchReplicaSpecs", "Worker", "template"})
66+
local worker_spec = get(observedObj, {"spec", "pytorchReplicaSpecs", "Worker"})
67+
if worker_spec == nil then
68+
return components
69+
end
70+
local worker_replicas = to_num(worker_spec.replicas, 1)
71+
local worker_template = worker_spec.template
6472
6573
local worker_requires = {}
6674
if worker_template ~= nil then
@@ -132,7 +140,6 @@ spec:
132140
local completionTime = nil
133141
local lastReconcileTime = nil
134142
local replicaStatuses = {}
135-
local conditions = {}
136143
local aggregatedConditions = {}
137144
local successfulClustersNum = 0
138145
local failedClusters = {}
@@ -141,9 +148,6 @@ spec:
141148
replicaStatuses.Master = { active = 0, failed = 0, succeeded = 0 }
142149
replicaStatuses.Worker = { active = 0, failed = 0, succeeded = 0 }
143150
144-
-- Count the number of member clusters with latest status
145-
local observedResourceTemplateGenerationCount = 0
146-
147151
for i = 1, #statusItems do
148152
if statusItems[i].status ~= nil then
149153
-- Aggregate time fields (earliest start time, latest completion time and reconcile time)
@@ -185,6 +189,8 @@ spec:
185189
local finishedType = ""
186190
if statusItems[i].status.conditions ~= nil then
187191
for _, c in ipairs(statusItems[i].status.conditions) do
192+
-- Like kubernetes native Job, we do not merge conditions from member clusters,
193+
-- but generate a new condition by PytorchJob finish state.
188194
-- table.insert(aggregatedConditions, c)
189195
if (c.type == "Succeeded" or c.type == "Failed") and c.status == "True" then
190196
isFinished = true

0 commit comments

Comments
 (0)