Skip to content
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

Added average function to badges #1029

Merged
merged 10 commits into from
Dec 22, 2024
Merged

Added average function to badges #1029

merged 10 commits into from
Dec 22, 2024

Conversation

ArneTR
Copy link
Member

@ArneTR ArneTR commented Dec 20, 2024

Greptile Summary

Enhanced CI badge functionality by adding configurable time-based average metrics and improving server-side calculations for better performance and accuracy.

  • Added duration validation (1-365 days) and weighted averages for CPU utilization and carbon intensity in /api/eco_ci.py
  • Moved statistics calculations from client-side JS to server-side SQL for improved performance
  • Updated test assertions in /tests/frontend/test_frontend.py to reflect new weighted average calculations
  • Modified default date range in /frontend/js/ci.js to show last 7 days instead of next 7 days
  • Added proper error handling for duration_days parameter and improved date handling consistency

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

api/eco_ci.py Outdated Show resolved Hide resolved
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

Copy link

github-actions bot commented Dec 20, 2024

Old Energy Estimation

Eco-CI Output:

Label 🖥 avg. CPU utilization [%] 🔋 Total Energy [Joules] 🔌 avg. Power [Watts] Duration [Seconds]
Total Run (incl. overhead) 26.8052 2103.14 4.03 521.27
Measurement #1 26.7571 2103.14 4.05 519.47

🌳 CO2 Data:
City: Chicago, Lat: 41.8874, Lon: -87.6318
IP: 20.25.192.130
CO₂ from energy is: 0.864390540 g
CO₂ from manufacturing (embodied carbon) is: 0.148725529 g
Carbon Intensity for this location: 411 gCO₂eq/kWh
SCI: 1.013116 gCO₂eq / pipeline run emitted


Total cost of whole PR so far:

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

9 file(s) reviewed, 7 comment(s)
Edit PR Review Bot Settings | Greptile

frontend/ci.html Show resolved Hide resolved
api/eco_ci.py Outdated Show resolved Hide resolved
frontend/js/ci.js Outdated Show resolved Hide resolved
api/eco_ci.py Outdated Show resolved Hide resolved
api/eco_ci.py Outdated Show resolved Hide resolved
frontend/js/helpers/main.js Show resolved Hide resolved
tests/api/test_api_eco_ci.py Show resolved Hide resolved
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings | Greptile

frontend/js/ci.js Show resolved Hide resolved
api/eco_ci.py Show resolved Hide resolved
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 file(s) reviewed, 4 comment(s)
Edit PR Review Bot Settings | Greptile

tests/frontend/test_frontend.py Show resolved Hide resolved
tests/frontend/test_frontend.py Show resolved Hide resolved
tests/frontend/test_frontend.py Show resolved Hide resolved
frontend/js/ci.js Show resolved Hide resolved
Copy link

Eco-CI Output:

Label 🖥 avg. CPU utilization [%] 🔋 Total Energy [Joules] 🔌 avg. Power [Watts] Duration [Seconds]
Total Run (incl. overhead) 27.4755 2040.37 4.06 502.68
Measurement #1 27.4391 2040.37 4.07 500.97

🌳 CO2 Data:
City: Washington, Lat: 38.7095, Lon: -78.1539
IP: 20.42.51.112
CO₂ from energy is: 0.926327980 g
CO₂ from manufacturing (embodied carbon) is: 0.143421545 g
Carbon Intensity for this location: 454 gCO₂eq/kWh
SCI: 1.069750 gCO₂eq / pipeline run emitted


Total cost of whole PR so far:

@ArneTR ArneTR merged commit e9958de into main Dec 22, 2024
4 checks passed
@ArneTR ArneTR deleted the ci-badge-averages branch December 22, 2024 12:02
ArneTR added a commit that referenced this pull request Dec 22, 2024
* main:
  pytest.skip() [skip ci]
  Adding saving for image and volume sizes (#1027)
  Added average function to badges (#1029)
  Bump psutil from 6.1.0 to 6.1.1 (#1028)
  Removing href for non actual links [skip ci] (#1026)
  Badges for CI now include carbon and also Totals (#998)
  Removes dead link
  Bump aiohttp from 3.11.10 to 3.11.11 (#1025)
  Bump pydantic from 2.10.3 to 2.10.4 (#1024)
  Bump deepdiff from 8.0.1 to 8.1.1 (#1020)
  Updated cloud energy
  (fix): Unselect button broke repositories view
  Noise reduced run start (#1023)
  (improvement): More strict check
  Added unselect button [skip ci] (#1022)
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