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

API for codecarbon #145

Merged
merged 77 commits into from
May 19, 2021
Merged

API for codecarbon #145

merged 77 commits into from
May 19, 2021

Conversation

benoit-cty
Copy link
Contributor

@benoit-cty benoit-cty commented Apr 12, 2021

We build an API for CodeCarbon that allow to store emissions in a database.

The model used is:

  • Emissions : a list of emissions attached to a run (an experiment)
  • Run : a run of the application (a single ML training for example)
    • Experiment : a config of run (hardware/cloud), attached to a project.
      • Project : an application, attached to a team
        • Team : a group of people working on projects, attached to an organization
        • Organization : the top level, for a company or a non-profit.

Main packages used:

  • FastAPI
  • SQLAlchemy
  • Alembic

TODO before merge :

@SaboniAmine SaboniAmine mentioned this pull request Apr 12, 2021
marc alencon and others added 10 commits April 12, 2021 22:30
Adding repository to emissions persistence router
* refacto: extracting server as standalone package, api test setup (example on one router)

* feat: in memory emissions repository tests (to test the interface)

Co-authored-by: Amine Saboni <asaboni@octo.com>
Co-authored-by: benoit-cty <6603048+benoit-cty@users.noreply.github.com>
Merge pull request #160 from mlco2/api_refacto_repositories
@benoit-cty
Copy link
Contributor Author

@SaboniAmine Why the database model is in models.py is in the "domain" folder instead of "database" folder ?
And the "schemas.py", representing the Pydantic interface of the API is in "database" folder ?

I've read Octo blog https://blog.octo.com/application-domain-infrastructure-des-mots-de-la-layered-hexagonal-clean-architecture/ ;)

I will put Alembic file in database, is it ok ?

@benoit-cty benoit-cty requested review from Lothiraldan, vict0rsch, LiamConnell and SaboniAmine and removed request for Lothiraldan, LiamConnell and vict0rsch May 2, 2021 15:21
@SaboniAmine
Copy link
Collaborator

SaboniAmine commented May 19, 2021

Finally good for me, sorry for the delay.
Tests on routers (postman / tox) still do not pass with a PG database, but those are modelling / logic issues that we still did not address.

@benoit-cty benoit-cty marked this pull request as ready for review May 19, 2021 12:10
@benoit-cty benoit-cty changed the title [WIP] API for codecarbon API for codecarbon May 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants