[Bug] Expose scheduler error details when ModelAdapter scheduling fails#1899
[Bug] Expose scheduler error details when ModelAdapter scheduling fails#1899VaishnaviOnPC wants to merge 2 commits into
Conversation
Summary of ChangesHello @VaishnaviOnPC, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly improves the diagnostic capabilities for ModelAdapter scheduling failures. By capturing and exposing the underlying scheduler error details directly within the ModelAdapter's status conditions, users and operators can now quickly identify the root cause of scheduling issues, such as resource constraints or policy violations, without needing to delve into controller logs. This change streamlines troubleshooting and enhances the overall operational transparency of the system. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request improves error reporting for ModelAdapter scheduling failures by propagating the underlying scheduler error to the status condition. This is a valuable change for user visibility. The logic to handle the error and requeue with a fixed delay is now more explicit and consistent with other parts of the controller. I have one suggestion to improve observability for operators by ensuring scheduling failures are still logged.
| instance.Status.Phase = modelv1alpha1.ModelAdapterPending | ||
|
|
||
| condition := NewCondition( | ||
| string(modelv1alpha1.ModelAdapterConditionTypeScheduled), | ||
| metav1.ConditionFalse, | ||
| "SchedulingFailed", | ||
| err.Error(), | ||
| ) | ||
|
|
||
| if err2 := r.updateStatus(ctx, instance, condition); err2 != nil { | ||
| return ctrl.Result{}, err2 | ||
| } | ||
|
|
||
| return ctrl.Result{RequeueAfter: time.Duration(RetryBackoffSeconds) * time.Second}, nil |
There was a problem hiding this comment.
By handling the scheduling error and returning nil, the original error from schedulePods is no longer logged by the controller-runtime framework. This can be considered a regression in observability for operators who monitor controller logs. While surfacing the error in the status condition is a great improvement for users, it's also important to log these failures to aid in debugging.
I suggest adding a log statement to record the scheduling failure. Using an Info level is appropriate since this is a handled error condition that leads to a requeue.
klog.InfoS("Scheduling failed for ModelAdapter, will retry", "ModelAdapter", klog.KObj(instance), "error", err)
instance.Status.Phase = modelv1alpha1.ModelAdapterPending
condition := NewCondition(
string(modelv1alpha1.ModelAdapterConditionTypeScheduled),
metav1.ConditionFalse,
"SchedulingFailed",
err.Error(),
)
if err2 := r.updateStatus(ctx, instance, condition); err2 != nil {
return ctrl.Result{}, err2
}
return ctrl.Result{RequeueAfter: time.Duration(RetryBackoffSeconds) * time.Second}, nil26b4844 to
836acab
Compare
| return ctrl.Result{}, err | ||
| } | ||
| // Continue to loading phase instead of returning early | ||
| } else if len(candidatePods) > 0 { | ||
| // Some pods available but not enough, try with what we have | ||
| klog.Infof("Only %d ready pods available for model adapter %s, need %d more, will wait", len(candidatePods), klog.KObj(instance), neededReplicas) | ||
| return ctrl.Result{RequeueAfter: time.Duration(RetryBackoffSeconds) * time.Second}, nil | ||
| } else { |
There was a problem hiding this comment.
do these two cases ("not enough ready pods" and "no ready pods available") should also be add in status condition ?
There was a problem hiding this comment.
Thanks for reviewing. I updated the logic for both of those branches.
Pull Request Description
This PR improves error reporting when ModelAdapter scheduling fails.
Previously, when the scheduler failed to select a suitable pod, the controller
returned a generic scheduling failure, making it difficult for users and
operators to understand the root cause.
With this change, the underlying scheduler error is propagated and surfaced
directly in the ModelAdapter status condition message. This provides clearer
feedback for common scheduling failures such as no matching pods, unsatisfied
policies, or resource constraints.
Related Issues
Resolves: #1885
Testing
Submission Checklist