Skip to content

[misc] feat: optimize console output#29

Merged
tardis-key merged 1 commit into
verl-project:mainfrom
tardis-key:dev
Mar 24, 2026
Merged

[misc] feat: optimize console output#29
tardis-key merged 1 commit into
verl-project:mainfrom
tardis-key:dev

Conversation

@tardis-key
Copy link
Copy Markdown
Collaborator

@tardis-key tardis-key commented Mar 24, 2026

What does this PR do?

  1. Filter elements where ph=X to reduce warnings.
  2. Reduce progress output logs
  3. Eliminate the warning in python -m rl_insight.main

Checklist Before Starting

  • Search for similar PRs. Paste at least one query link here: ...
  • Format the PR title as [{modules}] {type}: {description} (This will be checked by the CI)
    • {modules} include mstx, mvtx, torch_profile, deployment, perf, algo, env, doc, data, cfg, ci, misc,
    • If this PR involves multiple modules, separate them with , like [mstx, ci]
    • {type} is in feat, fix, refactor, chore, test
    • If this PR breaks any API (CLI arguments, config, function signature, etc.), add [BREAKING] to the beginning of the title.
    • Example: [BREAKING][mstx, torch_profile] feat: support timeline parsing

Test

For changes that can not be tested by CI (e.g., algorithm implementation, new model support), validate by experiment(s) and show results like training curve plots, evaluation results, etc.

API and Usage Example

Demonstrate how the API changes if any, and provide usage example(s) if possible.

# Add code snippet or script demonstrating how to use this

Design & Code Changes

Demonstrate the high-level design if this PR is complex, and list the specific changes.

Checklist Before Submitting

Important

Please check all the following items before requesting a review, otherwise the reviewer might deprioritize this PR for review.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 focuses on optimizing console output and improving the user experience by reducing noise and unnecessary warnings. It achieves this by refining data filtering logic, decreasing the verbosity of progress indicators, and enhancing the package's main entry point for cleaner execution.

Highlights

  • Console Output Filtering: Implemented filtering for elements where ph is not 'X' in MSTX trace parsing to reduce console warnings.
  • Progress Log Reduction: Reduced the frequency of progress output logs during data processing to declutter the console.
  • CLI Entry Point Optimization: Refactored the main CLI entry point to use lazy loading, eliminating a warning when running python -m rl_insight.main.
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.

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.

@tardis-key tardis-key changed the title [msic] feat: optimize console output [misc] feat: optimize console output Mar 24, 2026
@tardis-key tardis-key merged commit 1b3bd1a into verl-project:main Mar 24, 2026
3 of 5 checks passed
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 aims to optimize console output by lazy-loading the main entry point, filtering trace events, and reducing progress log frequency. The changes are generally positive and align with the stated goals. However, I've identified a critical issue in the logic for reducing log frequency which can lead to a ZeroDivisionError when processing a small number of ranks. I have provided a code suggestion to fix this bug. The other changes appear to be correct and beneficial.

Comment on lines +83 to +86
if completed % (total_ranks // 10) == 0:
logger.info(
f"Completed rank {rank_id}: {completed}/{total_ranks} ({progress:.1f}%)"
)
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.

critical

The expression total_ranks // 10 can result in zero if total_ranks is less than 10. This will cause a ZeroDivisionError when calculating completed % 0. To prevent this crash, you should ensure the divisor is at least 1. A concise way to fix this is to use (total_ranks // 10 or 1), which defaults to 1 if the integer division result is 0.

Suggested change
if completed % (total_ranks // 10) == 0:
logger.info(
f"Completed rank {rank_id}: {completed}/{total_ranks} ({progress:.1f}%)"
)
if completed % (total_ranks // 10 or 1) == 0:
logger.info(
f"Completed rank {rank_id}: {completed}/{total_ranks} ({progress:.1f}%)"
)

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.

1 participant