Skip to content

Commit

Permalink
Rename SuccessPolicyDefault to SuccessPolicyChiefWorker
Browse files Browse the repository at this point in the history
Signed-off-by: Yi Chen <[email protected]>
  • Loading branch information
ChenYi015 committed Sep 29, 2024
1 parent 402e567 commit d1fa953
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions pkg/apis/tensorflow/v1/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ package v1
type SuccessPolicy string

const (
SuccessPolicyDefault SuccessPolicy = ""
SuccessPolicyAllWorkers SuccessPolicy = "AllWorkers"
SuccessPolicyChiefWorker SuccessPolicy = "ChiefWorker"
SuccessPolicyAllWorkers SuccessPolicy = "AllWorkers"
)
7 changes: 4 additions & 3 deletions pkg/apis/tensorflow/v1/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"strings"

common "github.com/kubeflow/tf-operator/pkg/apis/common/v1"
"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
)

Expand Down Expand Up @@ -95,9 +95,10 @@ func SetDefaults_TFJob(tfjob *TFJob) {
running := common.CleanPodPolicyRunning
tfjob.Spec.CleanPodPolicy = &running
}
// Set default success policy to "".

// Set default success policy to ChiefWorker.
if tfjob.Spec.SuccessPolicy == nil {
defaultPolicy := SuccessPolicyDefault
defaultPolicy := SuccessPolicyChiefWorker
tfjob.Spec.SuccessPolicy = &defaultPolicy
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/tensorflow/v1/defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"reflect"
"testing"

"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"

common "github.com/kubeflow/tf-operator/pkg/apis/common/v1"
"github.com/kubeflow/tf-operator/pkg/util"
Expand Down Expand Up @@ -51,7 +51,7 @@ func expectedTFJob(cleanPodPolicy common.CleanPodPolicy, restartPolicy common.Re
)
}

defaultSuccessPolicy := SuccessPolicyDefault
defaultSuccessPolicy := SuccessPolicyChiefWorker

return &TFJob{
Spec: TFJobSpec{
Expand Down

0 comments on commit d1fa953

Please sign in to comment.