feat:NodeLockTimeout set from env - #1244
Conversation
|
Welcome @miaobyte! It looks like this is your first PR to Project-HAMi/HAMi 🎉 |
There was a problem hiding this comment.
Summary of Changes
Hello @miaobyte, 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 operational flexibility of the system by externalizing the node lock timeout configuration. Users can now easily customize this critical duration through an environment variable, which can be managed and deployed via Helm. This change streamlines the process of adapting the system to specific environmental requirements without requiring recompilation or direct code modification.
Highlights
- Configurability via Environment Variable: This pull request introduces the capability to configure the node lock timeout duration using the
HAMI_NODELOCK_EXPIREenvironment variable, allowing for dynamic adjustment without code changes. - Helm Chart Integration: The new
nodeLockExpiresetting has been integrated into the Helm chart (charts/hami/values.yamlandcharts/hami/templates/scheduler/deployment.yaml), enabling users to set this timeout directly through their deployment configurations. - Robust Default and Fallback: The system maintains a default node lock timeout of 5 minutes. If the
HAMI_NODELOCK_EXPIREenvironment variable is not set or its value cannot be parsed, the system gracefully falls back to this default, logging an error for clarity.
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 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 or fill out our survey 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.
Code Review
This pull request introduces a feature to configure the node lock timeout via the HAMI_NODELOCK_EXPIRE environment variable. The changes include updates to the Helm chart to expose this configuration and the core logic in Go to read the environment variable.
The implementation is straightforward, but there's a critical issue where the new configuration from the environment variable is overridden by an existing command-line flag configuration in cmd/scheduler/main.go, rendering the new feature ineffective. I've detailed this issue in my comments.
Additionally, I've provided a couple of suggestions to improve code maintainability and testability regarding comments, logging, and unit testing. Please address the critical issue to ensure the feature works as intended.
|
@miaobyte: you cannot LGTM your own PR. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
@miaobyte Could you please pay attention to the review suggestions of Gemini and make targeted modifications? |
|
@wawa0210 ok |
@wawa0210 OK |
|
In scenarios where a large number of tasks are submitted in a short period, the current 5-minute node lock timeout can cause nodes to remain locked for extended periods, preventing new tasks from being scheduled. Based on practical experience, reducing the timeout to 1 minute is a more reasonable choice that significantly improves cluster resource utilization and task throughput efficiency. This environment variable configuration approach maintains flexibility (allowing users to customize timeout periods according to their specific scenarios) while providing a better default experience for high-frequency task submission environments. The PR introduces this configuration option while maintaining backward compatibility with existing deployments. |
|
@wawa0210 done |
@wawa0210 done |
@wawa0210 |
|
/kind feature |
a833349 to
7234bee
Compare
Codecov Report❌ Patch coverage is
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
set to default 5m Signed-off-by: peng.li24 <peng.li24@nio.com>
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: miaobyte, Shouren, wawa0210 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
What this PR does / why we need it:
This PR adds functionality to configure the node lock timeout duration via an environment variable (
HAMI_NODELOCK_EXPIRE). This allows users to customize the timeout period according to their specific requirements without needing to modify and recompile the code.Which issue(s) this PR fixes:
Fixes #810
Special notes for your reviewer:
The default timeout remains at 5 minutes when the environment variable is not set or cannot be parsed correctly. When parsing fails, an error log is generated, and the system falls back to the default value.
Does this PR introduce a user-facing change?:
Yes. Users can now set the HAMI_NODELOCK_EXPIRE environment variable to customize the node lock timeout duration.