Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix https://github.com/kubeflow/training-operator/issues/1704 #1705

Merged
merged 3 commits into from
Jan 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to add req.NamespacedName.String() as well in the log

Copy link
Contributor Author

@HeGaoYuan HeGaoYuan Dec 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think add req.NamespaceName.String() is redundant and strange as a value of KV.
As following shows, the first is from logger.Info(err.Error(), "MPIJob failed validation", req.NamespacedName.String()), the second is from logger.Error(err, "MPIJob failed validation").
By the way, this also belongs to the log format problem that I think we should to optimize

1.6717681860476494e+09  INFO    PyTorchReplicaType is Master2 but must be one of [Master Worker]        {"pytorchjob": "default/pytorch-test-validate", "PyTorchJob failed validation": "default/pytorch-test-validate"}
1.6717681860476797e+09  ERROR   PyTorchJob failed validation    {"pytorchjob": "default/pytorch-test-validate", "error": "PyTorchReplicaType is Master2 but must be one of [Master Worker]"}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM

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