mlco2 / codecarbon

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

Refactor output methods #541

Open inimaz opened 5 months ago

inimaz commented 5 months ago

Goal

For every output method of the emissions tracker, we have a save_to_X param to pass. See : https://github.com/mlco2/codecarbon/blob/master/codecarbon/emissions_tracker.py#L229-L236 This can become very complex in the long run.

A nice thing will be to have just one param called output that allows an array of strings.

Before

EmissionTracker( save_to_api=True, save_to_file= True, ...)

After

EmissionTracker( output=["api","file"] ...)

What do you think?

LuisBlanche commented 4 months ago

Hey ! Why not but it is important to avoid using mutable default arguments

I don't see any 'list' types in the current __init__ method so we need to check whether this works with the _sentinel pattern works with lists