Add CI metrics collection infrastructure for stage-b jobs#16579
Add CI metrics collection infrastructure for stage-b jobs#16579harvenstar wants to merge 10 commits intosgl-project:mainfrom
Conversation
Summary of ChangesHello @harvenstar, 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 establishes the foundational infrastructure for collecting and uploading test metrics within the CI system. It introduces a new Python utility to consolidate individual process-level metric logs into a unified file, and integrates this process into existing CI workflows. The primary goal is to enhance diagnostic capabilities for flaky tests, facilitate root cause analysis, and enable future regression detection by consistently capturing and archiving detailed performance metrics. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Ignored Files
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.
Code Review
This pull request introduces a new script, scripts/ci/merge_metrics.py, to collect and merge CI metrics, which is a solid step towards better test analysis and regression detection. The script is well-structured and robust in handling invalid data.
My review focuses on improving the script's robustness and maintainability. I've identified a potential bug where the script could fail if no input metric files are found and the output directory doesn't exist. I've also suggested using Python's standard argparse module for command-line argument parsing to make the script more user-friendly and maintainable.
Overall, these are great changes that build a strong foundation for CI metrics collection.
- Add scripts/ci/merge_metrics.py to merge per-process JSONL files - Configure SGLANG_TEST_METRICS_OUTPUT in stage-b jobs - Upload metrics artifacts with if: always() for flaky test diagnosis - Include both merged and raw per-worker files for debugging Related to sgl-project#15996, follows up on sgl-project#16064
- Fix bug: ensure parent directory exists before creating empty output file - Add IOError exception handling when creating empty files - Replace manual argument parsing with argparse module for better UX
9b2b5ae to
a608c1c
Compare
Resolved conflicts by preserving metrics collection functionality while adopting upstream changes: - pr-test.yml: Keep metrics collection for stage-b-test-4-gpu-b200 - pr-test-amd.yml: Keep metrics collection and update suite names to match upstream naming conventions (stage-b-test-small-1-gpu-amd), update partition size to 12, and include new mi35x job
Add cleanup step to remove stale metrics from previous runs on self-hosted runners. This ensures each CI run starts with a clean metrics directory and only uploads metrics from the current run.
merrymercy
left a comment
There was a problem hiding this comment.
Can you show us an example run with example output file?
| matrix: | ||
| runner: [linux-mi325-gpu-2] | ||
| runs-on: ${{matrix.runner}} | ||
| env: |
There was a problem hiding this comment.
Setting this for every job is too redundant. Just use a global default value for all cases.
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: regression-metrics-${{ github.run_id }}-${{ github.job }} | ||
| path: ${{ env.METRICS_DIR }}/ |
There was a problem hiding this comment.
Adding three steps for each job is too redundant! Please do the following
- Unify your code into a github action like
actions/checkout@v4, so we can update the code in a single place without changing everywhere. - You can register post processing in the action, so the last two steps "Merge metrics" and "Upload metrics artifact" do not need to be there. Please refer to the "Post checkout code". It will run but users do not need to add one more step in the workflow file. It is coming form the
actions/checkout@v4. Also, please merge the last two steps.
- Create .github/actions/collect-test-metrics composite action - Action handles setup, merging, and uploading of test metrics - Update 4 jobs in pr-test.yml to use the new action: * stage-b-test-small-1-gpu * stage-b-test-large-1-gpu * stage-b-test-large-2-gpu * stage-b-test-4-gpu-b200 - Add global env variables for METRICS_DIR and SGLANG_TEST_METRICS_OUTPUT - Remove redundant per-job env definitions in pr-test-amd.yml
Resolved conflicts in .github/workflows/pr-test-amd.yml by: - Keeping global env variables (METRICS_DIR, SGLANG_TEST_METRICS_OUTPUT) - Adopting upstream changes: removed metrics collection steps, added --timeout-per-file flag - Adopting upstream run-name for /rerun-stage commands
- Add .github/actions/.*/dist/.* to codespell exclude pattern - Fix trailing whitespace in dist/index.js and dist/licenses.txt - Fix end-of-file in dist/index.js The dist/ directory contains bundled third-party dependencies with pre-existing spelling variations that should not be modified.
Background
This PR implements step 2 of the roadmap outlined in #15996: Set up CI infrastructure to collect and upload test metrics artifacts.
Builds on top of #16064 which added the
dump_metric()function and integrated it intorun_eval.py.Changes
New script:
scripts/ci/merge_metrics.pytest_metrics.*.jsonl) into single outputCI workflows:
pr-test.ymlandpr-test-amd.ymlSGLANG_TEST_METRICS_OUTPUTin all stage-b jobs:stage-b-test-small-1-gpu(8 partitions)stage-b-test-large-1-gpustage-b-test-large-2-gpustage-b-test-4-gpu-b200if: always()(runs even on test failure)$METRICS_DIR/as artifact withif: always()Artifact contents
test_metrics.jsonl- merged metrics for trend analysistest_metrics.*.jsonl- per-worker raw files for debuggingReason
Verification
regression-metrics-{run_id}-{job}-[partition-{N}]artifactsNext Steps
After this PR:
test_standalone_speculative_decoding.pyto usedump_metric()test_hicache_variants.pyto usedump_metric()Related: #15996
Depends on: #16064