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

Badges for CI now include carbon and also Totals #998

Merged
merged 9 commits into from
Dec 19, 2024

Conversation

ArneTR
Copy link
Member

@ArneTR ArneTR commented Nov 24, 2024

Screenshot 2024-11-24 at 2 47 39 PM

Greptile Summary

Enhanced CI badge functionality to support both energy (uJ) and carbon (ugCO2e) metrics, with improved display scaling and aggregation options for last runs and totals.

  • Updated api/api_helpers.py to rename rescale_energy_value to rescale_metric_value for handling both energy and carbon units
  • Added LIMIT 1 clause in api/eco_ci.py SQL queries to prevent multiple row returns in 'last' mode
  • Added duration-based filtering and totals mode support in api/eco_ci.py for aggregate metrics
  • Updated badge generation logic in api/main.py to be metric-agnostic
  • Added comprehensive test coverage in tests/api/test_api_helpers.py for both energy and carbon metric scaling

Base automatically changed from enterprise to main November 24, 2024 13:48
Copy link

github-actions bot commented Nov 24, 2024

Old Energy Estimation

Eco-CI Output:

Label 🖥 avg. CPU utilization [%] 🔋 Total Energy [Joules] 🔌 avg. Power [Watts] Duration [Seconds]
Total Run (incl. overhead) 26.1799 2373.53 4.03 589.54
Measurement #1 26.1367 2373.53 4.04 587.46

🌳 CO2 Data:
City: San Jose, Lat: 37.1835, Lon: -121.7714
IP: 52.160.165.48
CO₂ from energy is: 0.519803070 g
CO₂ from manufacturing (embodied carbon) is: 0.168203902 g
Carbon Intensity for this location: 219 gCO₂eq/kWh
SCI: 0.688007 gCO₂eq / pipeline run emitted

Copy link

github-actions bot commented Nov 24, 2024

Old Energy Estimation

Eco-CI Output:

Label 🖥 avg. CPU utilization [%] 🔋 Total Energy [Joules] 🔌 avg. Power [Watts] Duration [Seconds]
Total Run (incl. overhead) 26.1126 2322.83 4.00 580.39
Measurement #1 26.0694 2322.83 4.02 578.53

🌳 CO2 Data:
City: Chicago, Lat: 41.8874, Lon: -87.6318
IP: 20.25.192.48
CO₂ from energy is: 0.782793710 g
CO₂ from manufacturing (embodied carbon) is: 0.165593281 g
Carbon Intensity for this location: 337 gCO₂eq/kWh
SCI: 0.948387 gCO₂eq / pipeline run emitted

* main: (46 commits)
  Updated cloud energy
  (fix): Unselect button broke repositories view
  Noise reduced run start (#1023)
  (improvement): More strict check
  Added unselect button [skip ci] (#1022)
  (fix): tests
  Clickable Comparsion Charts + Display Missing Values (#1017)
  Bump uvicorn[standard] from 0.32.1 to 0.34.0 (#1019)
  Bump playwright/python in /docker/auxiliary-containers/gcb_playwright (#1018)
  Updated EE
  Adding not implemented error
  Kill script for GMT must use full commandline when killing reporters
  +x for tcpdump
  Tcp dump (#919)
  Hash must be decoded to understand spaces [skip ci]
  Allowing Deeplinks to specific phases [skip ci] (#1016)
  Bump python from 3.13.0-slim-bookworm to 3.13.1-slim-bookworm in /docker (#1015)
  Bump pydantic from 2.10.2 to 2.10.3 (#1010)
  Bump fastapi[standard] from 0.115.5 to 0.115.6 (#1011)
  Bump aiohttp from 3.11.9 to 3.11.10 (#1013)
  ...
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.

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

api/eco_ci.py Show resolved Hide resolved
api/main.py Outdated Show resolved Hide resolved
frontend/ci.html Show resolved Hide resolved
api/main.py Outdated Show resolved Hide resolved
frontend/ci.html Show resolved Hide resolved
api/api_helpers.py Show resolved Hide resolved
frontend/js/ci.js Show resolved Hide resolved
tests/api/test_api_helpers.py Outdated Show resolved Hide resolved
tests/api/test_api_helpers.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.

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

frontend/ci.html Show resolved Hide resolved
api/api_helpers.py Show resolved Hide resolved
api/eco_ci.py Outdated Show resolved Hide resolved
tests/api/test_api_helpers.py Show resolved Hide resolved
Copy link

github-actions bot commented Dec 19, 2024

Old Energy Estimation

Eco-CI Output:

Label 🖥 avg. CPU utilization [%] 🔋 Total Energy [Joules] 🔌 avg. Power [Watts] Duration [Seconds]
Total Run (incl. overhead) 25.2141 2342.12 3.98 589.01
Measurement #1 25.1912 2342.12 3.99 587.09

🌳 CO2 Data:
City: San Jose, Lat: 37.1835, Lon: -121.7714
IP: 52.234.46.147
CO₂ from energy is: 0.613635440 g
CO₂ from manufacturing (embodied carbon) is: 0.168052686 g
Carbon Intensity for this location: 262 gCO₂eq/kWh
SCI: 0.781688 gCO₂eq / pipeline run emitted

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.

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

api/api_helpers.py Show resolved Hide resolved
api/eco_ci.py 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.1946 2083.17 4.05 513.93
Measurement #1 27.1636 2083.17 4.07 512.21

🌳 CO2 Data:
City: Boydton, Lat: 36.6676, Lon: -78.3875
IP: 68.154.30.167
CO₂ from energy is: 0.841600680 g
CO₂ from manufacturing (embodied carbon) is: 0.146631325 g
Carbon Intensity for this location: 404 gCO₂eq/kWh
SCI: 0.988232 gCO₂eq / pipeline run emitted

@ArneTR ArneTR merged commit 82f2946 into main Dec 19, 2024
4 checks passed
@ArneTR ArneTR deleted the totals-and-carbon-badges-for-ci branch December 19, 2024 17:43
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