mlco2 / codecarbon

Track emissions from Compute and recommend ways to reduce their impact on the environment.
https://mlco2.github.io/codecarbon
MIT License
1k stars 157 forks source link

chore(carbonserver) rework api endpoints and models #577

Closed prmths128 closed 2 weeks ago

prmths128 commented 2 weeks ago

Add organization_id to Project Rework project endpoints a bit.

issue: https://github.com/orgs/mlco2/projects/4/views/1?pane=issue&itemId=67359449

Context: Rework API to have the following structure:

- Org
  - Project
    - Experiment
      - Run
        - Measure
- User

L'idée est de mettre un peu en évidence la hiérarchie des concepts sans compliquer les choses. Avoir une URL de type runs/{id}/projects//experiments//runs/id>/measures serait ingérable. Mais avoir /organizations/<id>/projects permet de mettre en évidence les liens entre les structures

J'ai mis pour chaque item un accès à partir du parent ou par query param. Ex: les 2 chemins suivant reviennent au meme (uniquement pour lister les éléments pour ne pas avoir de duplication inutile):

prmths128 commented 2 weeks ago

Not sure about moving other project endpoints. There could a middle ground to have but if we start to follow strictly the hierarchy in the URL we'll end up with overly complicated URLs. I'll reorganize a bit and we can discuss after if we go further.