-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Improve ci monitor #11249
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?
Improve ci monitor #11249
Conversation
- Use specific exception (RequestException) instead of bare except - Calculate failure rate once and reuse to avoid inconsistency
Summary of ChangesHello @Kangyan-Zhou, 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 enhances the CI monitoring system by refining existing analytics and introducing a dedicated tool for identifying flaky jobs. The changes aim to provide a clearer and more precise understanding of CI stability and problematic areas, allowing developers to more effectively address intermittent failures and improve overall CI reliability. Highlights
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.
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 introduces several valuable improvements to the CI monitoring scripts. The changes in ci_analyzer.py
to filter runs by the main
branch, refine the success rate calculation, and sort failing jobs by failure rate are excellent enhancements that make the report more accurate and actionable. The new ci_analyzer_flaky_jobs.py
script is a great addition for identifying and tracking flaky tests, which is crucial for CI stability.
My review comments focus on improving the flexibility and maintainability of the new script. I've suggested parameterizing hardcoded values like the repository name and branch, using constants instead of magic numbers and inline lists, and ensuring consistency between the two analyzer scripts. Additionally, there's some code duplication between the two files (e.g., get_recent_runs
) that could be refactored into a shared base class or utility module in the future to improve long-term maintainability.
params = { | ||
"per_page": min(per_page, limit - len(all_runs)), | ||
"page": page, | ||
"branch": "main", |
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.
def __init__(self, token: str): | ||
self.token = token | ||
self.base_url = "https://api.github.com" | ||
self.repo = "sgl-project/sglang" |
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.
|
||
while len(all_runs) < limit: | ||
url = f"{self.base_url}/repos/{self.repo}/actions/runs" | ||
params = {"per_page": min(per_page, limit - len(all_runs)), "page": page} |
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.
This get_recent_runs
implementation fetches runs from all branches, which is inconsistent with the change in ci_analyzer.py
that filters for the 'main' branch. To ensure consistent and focused analysis, consider adding a branch filter here as well. You could hardcode 'main' for now or make it a configurable parameter.
params = {"per_page": min(per_page, limit - len(all_runs)), "page": page} | |
params = {"per_page": min(per_page, limit - len(all_runs)), "page": page, "branch": "main"} |
if job_name in [ | ||
"check-changes", | ||
"pr-test-finish", | ||
"pr-test-h20-finish", | ||
"lint", | ||
]: |
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.
This list of ignored jobs is hardcoded inside the method. For better maintainability and readability, it's best practice to define this as a class-level constant. Using a set
is also more performant for membership checks than a list
.
if job_name in [ | |
"check-changes", | |
"pr-test-finish", | |
"pr-test-h20-finish", | |
"lint", | |
]: | |
if job_name in { | |
"check-changes", | |
"pr-test-finish", | |
"pr-test-h20-finish", | |
"lint", | |
}: |
flaky_stats["flaky_jobs"][job_name]["flaky_count"] += 1 | ||
|
||
# Store example (limit to 5 per job) | ||
if len(flaky_stats["flaky_jobs"][job_name]["examples"]) < 5: |
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.
7c26acd
to
d4ab736
Compare
19e9ea2
to
000c185
Compare
Motivation
Modifications
Accuracy Tests
Benchmarking and Profiling
Checklist