-
Notifications
You must be signed in to change notification settings - Fork 36
"qm-oom-score-adj" added: extract the last line of the output #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
Signed-off-by: pengshanyu <[email protected]>
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. |
When retrieving
QM_PIDandQM_FFI_PID, extract the last line of the output to enhance code robustness.Resolve errors that occur when warning messages appear in the output. For example:
Summary by Sourcery
Enhancements: