mlco2 / codecarbon

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

Too many variables when initializing the EmissionsTracker #404

Open inimaz opened 1 year ago

inimaz commented 1 year ago

Description

The BaseEmissionsTracker accepts 22 variables when initialized (and growing). This could lead to potential issues. And it is a known code smell.

What I Propose

Refactor the input variables to accept a config dict object as input.

So instead of

EmissionsTracker(project_name: "My project", measure_power_secs=10, output_dir="./temp")

codecarbon could do

config_options = {
    project_name: "My project",
    measure_power_secs=10,
    output_dir="./temp",
}
EmissionsTracker(config_options)
benoit-cty commented 1 year ago

Or maybe we could use kwargs ?

essp-lbg commented 8 months ago

@inimaz im interested in making this contribution. if you dynamically pass dict object to the EmissionsTracker class how would the developer know which variables are required as input?