Skip to content

[Bug] Expose scheduler error details when ModelAdapter scheduling fails#1899

Open
VaishnaviOnPC wants to merge 2 commits into
vllm-project:mainfrom
VaishnaviOnPC:fix-modeladapter-scheduler-error
Open

[Bug] Expose scheduler error details when ModelAdapter scheduling fails#1899
VaishnaviOnPC wants to merge 2 commits into
vllm-project:mainfrom
VaishnaviOnPC:fix-modeladapter-scheduler-error

Conversation

@VaishnaviOnPC
Copy link
Copy Markdown

@VaishnaviOnPC VaishnaviOnPC commented Jan 21, 2026

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

  • `go build ./...` passes locally
  • Unit tests pass for non-envtest packages
  • Envtest and integration tests fail locally on Windows due to missing envtest binaries (etcd/kube-apiserver) and Redis
  • CI is expected to cover envtest and integration scenarios

Submission Checklist

  • PR title includes appropriate prefix(es)
  • Changes are clearly explained in the PR description
  • New and existing tests pass successfully
  • Code adheres to project style and best practices
  • Documentation updated to reflect changes (if applicable)
  • Thorough testing completed, no regressions introduced

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @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

  • Enhanced Error Reporting: The system now provides detailed scheduler error messages directly in the ModelAdapter status when scheduling fails, replacing generic failure messages.
  • Status Update: Upon a scheduling failure, the ModelAdapter's phase is set to 'Pending', and a 'SchedulingFailed' condition is added to its status with the specific error details.
  • Requeue Mechanism: Failed scheduling attempts now trigger a requeue of the reconciliation loop after a defined backoff period, allowing for retry.

🧠 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 Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

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.

Comment on lines +632 to +645
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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

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}, nil

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

add a error log sgtm

@googs1025 googs1025 force-pushed the fix-modeladapter-scheduler-error branch from 26b4844 to 836acab Compare April 9, 2026 14:38
Comment on lines 675 to 682
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 {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

do these two cases ("not enough ready pods" and "no ready pods available") should also be add in status condition ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks for reviewing. I updated the logic for both of those branches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disclose exact pending reason for failed to schedule lora

2 participants