Skip to content

Commit

Permalink
Stop to connect condition type and reason in JobSet plugin
Browse files Browse the repository at this point in the history
Signed-off-by: Yuki Iwai <[email protected]>
  • Loading branch information
tenzen-y committed Nov 9, 2024
1 parent 58b1a00 commit b2cc1ef
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
5 changes: 2 additions & 3 deletions pkg/runtime.v2/framework/core/framework_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package core

import (
"context"
"fmt"
"testing"

"github.com/google/go-cmp/cmp"
Expand Down Expand Up @@ -612,7 +611,7 @@ func TestTerminalConditionPlugins(t *testing.T) {
Obj(),
wantCondition: &metav1.Condition{
Type: kubeflowv2.TrainJobComplete,
Reason: fmt.Sprintf("%sDueTo%s", jobsetv1alpha2.JobSetCompleted, jobsetconsts.AllJobsCompletedReason),
Reason: jobsetconsts.AllJobsCompletedReason,
Message: jobsetconsts.AllJobsCompletedMessage,
Status: metav1.ConditionTrue,
},
Expand All @@ -631,7 +630,7 @@ func TestTerminalConditionPlugins(t *testing.T) {
Obj(),
wantCondition: &metav1.Condition{
Type: kubeflowv2.TrainJobFailed,
Reason: fmt.Sprintf("%sDueTo%s", jobsetv1alpha2.JobSetFailed, jobsetconsts.FailedJobsReason),
Reason: jobsetconsts.FailedJobsReason,
Message: jobsetconsts.FailedJobsMessage,
Status: metav1.ConditionTrue,
},
Expand Down
2 changes: 0 additions & 2 deletions pkg/runtime.v2/framework/plugins/jobset/jobset.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,10 @@ func (j *JobSet) TerminalCondition(ctx context.Context, trainJob *kubeflowv2.Tra
return nil, err
}
if completed := meta.FindStatusCondition(jobSet.Status.Conditions, string(jobsetv1alpha2.JobSetCompleted)); completed != nil && completed.Status == metav1.ConditionTrue {
completed.Reason = fmt.Sprintf("%sDueTo%s", completed.Type, completed.Reason)
completed.Type = kubeflowv2.TrainJobComplete
return completed, nil
}
if failed := meta.FindStatusCondition(jobSet.Status.Conditions, string(jobsetv1alpha2.JobSetFailed)); failed != nil && failed.Status == metav1.ConditionTrue {
failed.Reason = fmt.Sprintf("%sDueTo%s", failed.Type, failed.Reason)
failed.Type = kubeflowv2.TrainJobFailed
return failed, nil
}
Expand Down
4 changes: 2 additions & 2 deletions test/integration/controller.v2/trainjob_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ var _ = ginkgo.Describe("TrainJob controller", ginkgo.Ordered, func() {
{
Type: kubeflowv2.TrainJobComplete,
Status: metav1.ConditionTrue,
Reason: fmt.Sprintf("%sDueTo%s", jobsetv1alpha2.JobSetCompleted, jobsetconsts.AllJobsCompletedReason),
Reason: jobsetconsts.AllJobsCompletedReason,
Message: jobsetconsts.AllJobsCompletedMessage,
},
}, util.IgnoreConditions))
Expand Down Expand Up @@ -481,7 +481,7 @@ var _ = ginkgo.Describe("TrainJob controller", ginkgo.Ordered, func() {
{
Type: kubeflowv2.TrainJobFailed,
Status: metav1.ConditionTrue,
Reason: fmt.Sprintf("%sDueTo%s", jobsetv1alpha2.JobSetFailed, jobsetconsts.FailedJobsReason),
Reason: jobsetconsts.FailedJobsReason,
Message: jobsetconsts.FailedJobsMessage,
},
}, util.IgnoreConditions))
Expand Down

0 comments on commit b2cc1ef

Please sign in to comment.