From 45c8e1b1507490f55166ce87bf2086456986134a Mon Sep 17 00:00:00 2001 From: Yi Chen Date: Mon, 14 Oct 2024 17:57:16 +0800 Subject: [PATCH] fix: unsupported success policy when success policy is not specified (#1170) Signed-off-by: Yi Chen --- pkg/argsbuilder/submit_tfjob.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/argsbuilder/submit_tfjob.go b/pkg/argsbuilder/submit_tfjob.go index f3222e470..bd28ab9ed 100644 --- a/pkg/argsbuilder/submit_tfjob.go +++ b/pkg/argsbuilder/submit_tfjob.go @@ -11,6 +11,7 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License + package argsbuilder import ( @@ -34,6 +35,7 @@ import ( const ( disableTFConfigAnnotation = "arena.kubeflow.org/disable-tf-config" + TFJobSuccessPolicyDefault = "" TFJobSuccessPolicyChiefWorker = "ChiefWorker" TFJobSuccessPolicyAllWorkers = "AllWorkers" ) @@ -268,7 +270,7 @@ func (s *SubmitTFJobArgsBuilder) setRunPolicy() error { func (s *SubmitTFJobArgsBuilder) check() error { switch s.args.SuccessPolicy { - case TFJobSuccessPolicyChiefWorker, TFJobSuccessPolicyAllWorkers: + case TFJobSuccessPolicyDefault, TFJobSuccessPolicyAllWorkers: log.Debugf("Supported successPolicy: %s", s.args.SuccessPolicy) default: return fmt.Errorf("unsupported successPolicy %s", s.args.SuccessPolicy) @@ -417,7 +419,7 @@ func (s *SubmitTFJobArgsBuilder) transform() error { if s.args.SuccessPolicy == TFJobSuccessPolicyChiefWorker { // The value of chief worker policy actually is empty string in training-operator. - s.args.SuccessPolicy = "" + s.args.SuccessPolicy = TFJobSuccessPolicyDefault } return nil