Skip to content

Commit

Permalink
Remove a redundant condition check
Browse files Browse the repository at this point in the history
Signed-off-by: Yuki Iwai <yuki.iwai.tz@gmail.com>
  • Loading branch information
tenzen-y committed Jul 11, 2023
1 parent 31154ff commit 1ab6390
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/controller.v1/common/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ func (jc *JobController) ReconcileJobs(
jobStatus.ReplicaStatuses[rType].Active = 0
}
jobStatus.StartTime = nil
msg := fmt.Sprintf("%s %s is suspended.", jc.Controller.GetAPIGroupVersionKind().Kind, jobName)
msg := fmt.Sprintf("%s %s is suspended.", jobKind, jobName)
if commonutil.IsRunning(jobStatus) {
if err = commonutil.UpdateJobConditions(&jobStatus, apiv1.JobRunning, corev1.ConditionFalse,
commonutil.NewReason(jobKind, commonutil.JobSuspendedReason), msg); err != nil {
Expand All @@ -167,8 +167,8 @@ func (jc *JobController) ReconcileJobs(
}
return nil
}
if !trainutil.IsJobSuspended(runPolicy) && commonutil.IsSuspend(jobStatus) {
msg := fmt.Sprintf("%s %s is resumed.", jc.Controller.GetAPIGroupVersionKind().Kind, jobName)
if commonutil.IsSuspend(jobStatus) {
msg := fmt.Sprintf("%s %s is resumed.", jobKind, jobName)
if err = commonutil.UpdateJobConditions(&jobStatus, apiv1.JobSuspended, corev1.ConditionFalse,
commonutil.NewReason(jobKind, commonutil.JobResumedReason), msg); err != nil {
return err
Expand Down

0 comments on commit 1ab6390

Please sign in to comment.