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

Carbondb unique #877

Merged
merged 2 commits into from
Sep 27, 2024
Merged

Carbondb unique #877

merged 2 commits into from
Sep 27, 2024

Conversation

ArneTR
Copy link
Member

@ArneTR ArneTR commented Aug 26, 2024

The constraint for the uniqueness in CarbonDB was not looking at all relevant rows.

We had this already implemented on our live system but not backported it to the repository.

The implementation so far was however not respecting NULL values correctly. The new unique index now treats two NULL values as identical and will trigger now.

@ribalba Data volume is now down from 13 GB to 9 MB

@ArneTR ArneTR requested a review from ribalba August 26, 2024 09:33
Copy link

Eco-CI Output:

Label 🖥 avg. CPU utilization [%] 🔋 Total Energy [Joules] 🔌 avg. Power [Watts] Duration [Seconds]
Total Run (incl. overhead) 23.2264 1641.29 3.85 426
Measurement #1 23.1623 1641.29 3.87 424

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

Copy link
Member

@ribalba ribalba left a comment

Choose a reason for hiding this comment

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

We should talk about how to change this. After we have auth we can implement this totally different and far nicer. I only used uuid because we didn't have auth. I think this should be refactored


ALTER TABLE IF EXISTS public.carbondb_energy_data_day
ADD CONSTRAINT unique_machine_project_date UNIQUE (machine, date);
CREATE UNIQUE INDEX unique_entry ON carbondb_energy_data_day (type, company, machine, project, tags, date) NULLS NOT DISTINCT;
Copy link
Member

Choose a reason for hiding this comment

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

Why are you adding eh company and the project? Initially the idea was that you only need a machine. But I think we are going to rework this anyway

@ArneTR ArneTR merged commit c510ed4 into main Sep 27, 2024
4 checks passed
@ArneTR ArneTR deleted the carbondb-unique branch September 27, 2024 11:37
ArneTR added a commit that referenced this pull request Sep 27, 2024
* main:
  Authentication in GMT (#872)
  Phase name check (#893)
  Carbondb unique (#877)
  Added DiskIO Reporter (#825)
  Bump pylint from 3.3.0 to 3.3.1 (#913)
  Bump aiohttp from 3.10.5 to 3.10.6 (#912)
  Bump plotext from 5.3.1 to 5.3.2 (#914)
  Bump pandas from 2.2.2 to 2.2.3 (#910)
  Bump plotext from 5.2.8 to 5.3.1 (#909)
  Bump pylint from 3.2.7 to 3.3.0 (#911)
  Bump psycopg-pool from 3.2.2 to 3.2.3 (#901)
  Bump pydantic from 2.9.1 to 2.9.2 (#904)
  Bump fastapi[standard] from 0.114.2 to 0.115.0 (#905)
  Importer for Measurements (#908)
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.

2 participants