chore(api): Remove duplicate TrainJob status patch#3448
chore(api): Remove duplicate TrainJob status patch#3448robert-bell wants to merge 2 commits intokubeflow:masterfrom
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Pull request overview
Refactors the TrainJob reconciliation loop to remove duplicated status-patching logic introduced in #3258, and simplifies reconcileDeadline since it never returns an error.
Changes:
- Consolidates TrainJob status patching into a single location in
Reconcile. - Changes
reconcileDeadlinesignature to return onlyctrl.Result. - Adjusts deadline-based requeue handling to reuse the unified status patch logic.
| } | ||
| deadlineResult := r.reconcileDeadline(ctx, &trainJob) | ||
|
|
||
| if !equality.Semantic.DeepEqual(&trainJob.Status, prevTrainJob.Status) { |
There was a problem hiding this comment.
The DeepEqual call compares &trainJob.Status (a pointer) with prevTrainJob.Status (a value), which will always evaluate as different and cause a status patch on every reconcile; compare like-for-like (either both values or both pointers) to avoid unnecessary API writes and update conflicts.
| if !equality.Semantic.DeepEqual(&trainJob.Status, prevTrainJob.Status) { | |
| if !equality.Semantic.DeepEqual(trainJob.Status, prevTrainJob.Status) { |
There was a problem hiding this comment.
@robert-bell I think it would be great if you fix this in this PR as well.
There was a problem hiding this comment.
Updated.
cc @astefanutti @andreyvelich - I think this came up before in #3227 but we reverted the change that time. Just flagging in case you wanted to comment.
I think we should make this change though - testing locally, the current logic is always returning false so we're making a status patch on every reconcile regardless of whether the status has changed.
Signed-off-by: Rob Bell <robell@redhat.com>
Signed-off-by: Rob Bell <robell@redhat.com>
03a6ed1 to
64bfc42
Compare
|
Thanks for the review @XploY04. PTAL. I've also rebased which should hopefully fix the ci e2e tests. |
What this PR does / why we need it:
Small refactoring to tidy up the implementation from #3258.
reconcileDeadlineto returnctrl.Resultinstead of(ctrl.Result, error)since it never returned non-nil errors.Checklist: