-
Notifications
You must be signed in to change notification settings - Fork 36
improve "qm-oom-score-adj": extracting a "podman inspect" method #946
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
base: main
Are you sure you want to change the base?
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideModify all retrieval steps for PIDs, statuses, and file contents to pipe through tail -1 before trimming control characters, ensuring only the last line of actual data is captured despite any preceding warnings. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Summary of ChangesHello @pengshanyu, 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 enhances the robustness of shell scripts by ensuring that command outputs are correctly parsed, specifically when retrieving process IDs (PIDs), container statuses, and OOM score adjustments. By filtering command output to only the last line, the changes prevent unexpected warning messages from interfering with subsequent script logic, making the scripts more resilient to variations in command-line tool behavior. Highlights
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 aims to make shell commands more robust by taking the last line of output, which is a good goal. However, the current implementation might not work as expected if warnings are printed to stderr, and it relies on TTY behavior for podman exec. I've provided suggestions to use 2>&1 to explicitly redirect stderr to stdout, which is a more robust and standard way to handle this. This also allows removing -it flags and tr commands, making the code cleaner. I've also pointed out a case where tail -1 is not necessary.
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.
Consider moving this
podman inspect "$container_name" --format '{{.State.Pid}}' 2>&1 | tail -1
To a method, with 2 args, ctr_name format,
It could save the fix in 3 places
b1bf8e9 to
93b9534
Compare
|
Hi @Yarboa , |
|
Hi @Yarboa , could you help to review it again, thanks. |
when did that happen, the warnings? |
|
Sure, I ping you the details. |
|
WARN[0000] The storage 'driver' option should be set in /etc/containers/storage.conf. This was happening last week, but with change to have el10 default location of cotainers.conf in aib: |
Yes, @pengshanyu and myself discussed it, and we verified the issue not occurrs anymore. But this PR has other changed which looks good Podman inspect method |
|
I would add that with this definition of podman_inspect made me think how often are we using run command in qm .... If we would gain something with for example: And I agree with changing character of this MR as it is bringing really nice improvements |
Signed-off-by: pengshanyu <yupengshan@hotmail.com>
5a27965 to
79c9da3
Compare
Done. |
Enhancements:
extracting "podman inspect" method
replace "echo" to "info_message"
catching stderr in "podman inspect" method, to ensure errors could be caught and monitored