Skip to content

Commit

Permalink
fix #1704 (#1705)
Browse files Browse the repository at this point in the history
* fix #1704

* use commonutil.JobFailedValidationReason replace of JobFailedValidation
  • Loading branch information
HeGaoYuan authored Jan 25, 2023
1 parent b6df1f0 commit d0fb5c0
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 6 deletions.
3 changes: 2 additions & 1 deletion pkg/controller.v1/mpi/mpijob_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ func (jc *MPIJobReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
}

if err = kubeflowv1.ValidateV1MpiJobSpec(&mpijob.Spec); err != nil {
logger.Info(err.Error(), "MPIJob failed validation", req.NamespacedName.String())
logger.Error(err, "MPIJob failed validation")
jc.Recorder.Eventf(mpijob, corev1.EventTypeWarning, commonutil.JobFailedValidationReason, "MPIJob failed validation because %s", err)
return ctrl.Result{}, err
}

Expand Down
4 changes: 3 additions & 1 deletion pkg/controller.v1/mxnet/mxjob_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ func (r *MXJobReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl
}

if err = kubeflowv1.ValidateV1MXJobSpec(&mxjob.Spec); err != nil {
logger.Info(err.Error(), "MXJob failed validation", req.NamespacedName.String())
logger.Error(err, "MXJob failed validation")
r.Recorder.Eventf(mxjob, corev1.EventTypeWarning, commonutil.JobFailedValidationReason, "MXJob failed validation because %s", err)
return ctrl.Result{}, err
}

// Check if reconciliation is needed
Expand Down
4 changes: 3 additions & 1 deletion pkg/controller.v1/paddlepaddle/paddlepaddle_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ func (r *PaddleJobReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
}

if err = kubeflowv1.ValidateV1PaddleJobSpec(&paddlejob.Spec); err != nil {
logger.Info(err.Error(), "PaddleJob failed validation", req.NamespacedName.String())
logger.Error(err, "PaddleJob failed validation")
r.Recorder.Eventf(paddlejob, corev1.EventTypeWarning, commonutil.JobFailedValidationReason, "PaddleJob failed validation because %s", err)
return ctrl.Result{}, err
}

// Check if reconciliation is needed
Expand Down
4 changes: 3 additions & 1 deletion pkg/controller.v1/pytorch/pytorchjob_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ func (r *PyTorchJobReconciler) Reconcile(ctx context.Context, req ctrl.Request)
}

if err = kubeflowv1.ValidateV1PyTorchJobSpec(&pytorchjob.Spec); err != nil {
logger.Info(err.Error(), "PyTorchJob failed validation", req.NamespacedName.String())
logger.Error(err, "PyTorchJob failed validation")
r.Recorder.Eventf(pytorchjob, corev1.EventTypeWarning, commonutil.JobFailedValidationReason, "PyTorchJob failed validation because %s", err)
return ctrl.Result{}, err
}

// Check if reconciliation is needed
Expand Down
4 changes: 3 additions & 1 deletion pkg/controller.v1/tensorflow/tfjob_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ func (r *TFJobReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl
}

if err = kubeflowv1.ValidateV1TFJobSpec(&tfjob.Spec); err != nil {
logger.Info(err.Error(), "TFJob failed validation", req.NamespacedName.String())
logger.Error(err, "TFJob failed validation")
r.Recorder.Eventf(tfjob, corev1.EventTypeWarning, commonutil.JobFailedValidationReason, "TFJob failed validation because %s", err)
return ctrl.Result{}, err
}

// Check if reconciliation is needed
Expand Down
4 changes: 3 additions & 1 deletion pkg/controller.v1/xgboost/xgboostjob_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ func (r *XGBoostJobReconciler) Reconcile(ctx context.Context, req ctrl.Request)
}

if err = kubeflowv1.ValidateXGBoostJobSpec(&xgboostjob.Spec); err != nil {
logger.Info(err.Error(), "XGBoostJob failed validation", req.NamespacedName.String())
logger.Error(err, "XGBoostJob failed validation")
r.Recorder.Eventf(xgboostjob, corev1.EventTypeWarning, commonutil.JobFailedValidationReason, "XGBoostJob failed validation because %s", err)
return ctrl.Result{}, err
}

// Check reconcile is required.
Expand Down

0 comments on commit d0fb5c0

Please sign in to comment.