green-coding-solutions / green-metrics-tool

Measure energy and carbon consumption of software
https://metrics.green-coding.io
GNU Affero General Public License v3.0
166 stars 22 forks source link

Calling fixture #826

Closed ArneTR closed 3 months ago

ArneTR commented 3 months ago

This PR is a wild one.

  1. Somehow the pytest fixture command got lost in a prior change leading to a non-complete cleaning of the database. Thus some old runs could be in there.

  2. The code in test_usage_scenario.py::test_uri_github_repo_branch was starting a run with a different branch and then checking if that run was in the DB. Since we now use pytest's randomization feature it seems like it does "fix" the random number generator for every module.

I am not sure if that should be called poisoning ... as in the end it makes tests still random over time but repeatable for a specific instance. In any case it leads to the fact that smoke_test.py and also test_usage_scenario.py::test_uri_github_repo_branch will generate the same random name for the run when calling utils.randomword(12).

This behaviour is now NOT altered but rather the DB correctly cleaned. However it should hopefully serve as some reminder or debug context when we run into fixed random numbers again in the future.

github-actions[bot] commented 3 months ago
Eco-CI Output: Label 🖥 avg. CPU utilization [%] 🔋 Total Energy [Joules] 🔌 avg. Power [Watts] Duration [Seconds]
Total Run (incl. overhead) 25.7227 1538.42 3.95 389
Measurement #1 25.6761 1538.42 3.98 387

🌳 CO2 Data: City: Washington, Lat: 38.7095, Lon: -78.1539 IP: 20.42.17.64 CO₂ from energy is: 0.652290080 g CO₂ from manufacturing (embodied carbon) is: 0.110987071 g Carbon Intensity for this location: 424 gCO₂eq/kWh SCI: 0.763277 gCO₂eq / pipeline run emitted