-
Notifications
You must be signed in to change notification settings - Fork 52
fix: benchmark container volume mounts update when base model exists #198
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Summary of Changes
Hello @carlory, 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 resolves a critical bug that prevented benchmark containers from correctly mounting model paths under specific configuration scenarios. The solution involves a targeted refactoring of a key utility function responsible for managing volume mounts, making it more explicit and robust by directly providing the necessary model identification information. This ensures that model paths are consistently mounted when a base model is present.
Highlights
- Bug Fix: Benchmark Container Volume Mounts: I've addressed a bug where the benchmark container failed to mount the model path correctly. This occurred specifically when the base model was defined in
isvc.Spec.Modelbutisvc.Spec.Predictor.Modelwas nil, leading to an incorrect determination of whether the model path should be mounted. - Refactor:
UpdateVolumeMountsUtility Function: TheUpdateVolumeMountsutility function inpkg/controller/v1beta1/benchmark/utils/utils.gohas been refactored. It now directly accepts thebaseModelNameas a string argument, simplifying its signature and internal logic. This removes its previous dependency on the fullInferenceServiceobject for extracting the model name. - Code Consistency and Test Updates: The call site for
UpdateVolumeMountsinpkg/controller/v1beta1/benchmark/controller.gohas been updated to align with the new function signature, passing thebaseModelNamedirectly. Corresponding unit tests inpkg/controller/v1beta1/benchmark/utils/utils_test.gowere also modified to reflect these changes, ensuring continued test coverage and correctness.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| 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 issue 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 is currently in preview and 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 to provide feedback.
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
-
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. ↩
There was a problem hiding this 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 fixes a bug where the benchmark container's volume mounts were not correctly updated when the base model was specified via isvc.Spec.Model. The fix refactors UpdateVolumeMounts to be independent of the InferenceService object, which is a good design improvement. The tests have been updated accordingly.
I've identified a potential panic in the updated UpdateVolumeMounts function if the base model's storage path is not defined. I've provided a suggestion to make the function safer and also recommended adding test cases to cover this scenario.
| func UpdateVolumeMounts(isvc *v1beta1.InferenceService, container *v1.Container, baseModel *v1beta1.BaseModelSpec) { | ||
| if isvc.Spec.Predictor.Model == nil || isvc.Spec.Predictor.Model.BaseModel == nil || baseModel == nil { | ||
| func UpdateVolumeMounts(container *v1.Container, baseModelName string, baseModel *v1beta1.BaseModelSpec) { | ||
| if baseModelName == "" || baseModel == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function could panic if baseModel.Storage or baseModel.Storage.Path is nil. The code at lines 139 and 145 dereferences baseModel.Storage.Path without checking if baseModel.Storage or baseModel.Storage.Path are nil.
Please add a check to ensure baseModel.Storage and baseModel.Storage.Path are not nil before proceeding.
| if baseModelName == "" || baseModel == nil { | |
| if baseModelName == "" || baseModel == nil || baseModel.Storage == nil || baseModel.Storage.Path == nil { | |
| return | |
| } |
| name: "without base model", | ||
| container: &v1.Container{}, | ||
| want: &v1.Container{}, | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To improve test coverage and prevent future regressions, it would be beneficial to add test cases for when baseModel is provided but its Storage or Storage.Path fields are nil. This will ensure the function handles these edge cases gracefully without panicking, especially after the recommended change in utils.go.
What type of PR is this?
/kind bug
What this PR does / why we need it:
when base model can be obtained from
isvc.Spec.Modelandisvc.Spec.Predictor.Modelis nil, the model path won't be mounted. it is not correct.Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?