Skip to content

Commit a652848

Browse files
authored
fix: fix mxnet failed to update StartTime and CompletionTime (#1643)
1 parent 32db9b9 commit a652848

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

pkg/controller.v1/mxnet/mxjob_controller.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,9 @@ func (r *MXJobReconciler) UpdateJobStatus(job interface{}, replicas map[commonv1
326326
return err
327327
}
328328

329-
if mxjob.Status.StartTime == nil {
329+
if jobStatus.StartTime == nil {
330330
now := metav1.Now()
331-
mxjob.Status.StartTime = &now
331+
jobStatus.StartTime = &now
332332
// enqueue a sync to check if job past ActiveDeadlineSeconds
333333
if mxjob.Spec.RunPolicy.ActiveDeadlineSeconds != nil {
334334
logrus.Infof("Job with ActiveDeadlineSeconds will sync after %d seconds", *mxjob.Spec.RunPolicy.ActiveDeadlineSeconds)
@@ -361,9 +361,9 @@ func (r *MXJobReconciler) UpdateJobStatus(job interface{}, replicas map[commonv1
361361
if expected == 0 {
362362
msg := fmt.Sprintf("MXJob %s is successfully completed.", mxjob.Name)
363363
r.Recorder.Event(mxjob, corev1.EventTypeNormal, mxJobSucceededReason, msg)
364-
if mxjob.Status.CompletionTime == nil {
364+
if jobStatus.CompletionTime == nil {
365365
now := metav1.Now()
366-
mxjob.Status.CompletionTime = &now
366+
jobStatus.CompletionTime = &now
367367
}
368368
err := commonutil.UpdateJobConditions(jobStatus, commonv1.JobSucceeded, mxJobSucceededReason, msg)
369369
if err != nil {
@@ -387,9 +387,9 @@ func (r *MXJobReconciler) UpdateJobStatus(job interface{}, replicas map[commonv1
387387
} else {
388388
msg := fmt.Sprintf("mxjob %s is failed because %d %s replica(s) failed.", mxjob.Name, failed, rtype)
389389
r.Recorder.Event(mxjob, corev1.EventTypeNormal, mxJobFailedReason, msg)
390-
if mxjob.Status.CompletionTime == nil {
390+
if jobStatus.CompletionTime == nil {
391391
now := metav1.Now()
392-
mxjob.Status.CompletionTime = &now
392+
jobStatus.CompletionTime = &now
393393
}
394394
err := commonutil.UpdateJobConditions(jobStatus, commonv1.JobFailed, mxJobFailedReason, msg)
395395
if err != nil {

0 commit comments

Comments
 (0)