-
Notifications
You must be signed in to change notification settings - Fork 705
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Always update TrainJob status on errors #2352
Conversation
Pull Request Test Coverage Report for Build 12320339089Details
💛 - Coveralls |
@@ -199,7 +200,7 @@ func setSuspendedCondition(trainJob *kubeflowv2.TrainJob) { | |||
|
|||
func setTerminalCondition(ctx context.Context, runtime jobruntimes.Runtime, trainJob *kubeflowv2.TrainJob) error { | |||
terminalCond, err := runtime.TerminalCondition(ctx, trainJob) | |||
if err != nil { | |||
if err != nil && !apierrors.IsNotFound(err) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of this, I'm wondering if we should update the status regardless of errors there: https://github.com/kubeflow/training-operator/blob/3eb1a0c9e3616a7fed9864d8b1373d6d677a6c77/pkg/controller.v2/trainjob_controller.go#L99-
So, if we get any error in L100
training-operator/pkg/controller.v2/trainjob_controller.go
Lines 96 to 98 in 3eb1a0c
if terminalCondErr := setTerminalCondition(ctx, runtime, &trainJob); terminalCondErr != nil { | |
return ctrl.Result{}, errors.Join(err, terminalCondErr) | |
} |
terminalCondErr
with error
, but we do not return error here.
In other words, we update the status in the case of status differences between old and new even if we get any errors from setCondition functions.
Because we do not restrict underlying Job to JobSet and we can not estimate that the NotFound
error can be ignored.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, that's much better!
I've just re-pushed. Let me know if that corresponds to what you had in mind.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great to see.
Signed-off-by: Antonin Stefanutti <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: tenzen-y The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What this PR does / why we need it:
Which issue(s) this PR fixes (optional, in
Fixes #<issue number>, #<issue number>, ...
format, will close the issue(s) when PR gets merged):Fixes #2351
Checklist: