-
Notifications
You must be signed in to change notification settings - Fork 173
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
Redesign Dashboard and Modularize Backend #6
Conversation
co2_tracker/co2_tracker.py
Outdated
output_dir (str): Directory path to which the experiment artifacts are saved. Saved to current directory | ||
by default. | ||
save_to_file (bool): Indicates if the emission artifacts should be logged to a file | ||
:param project_name: Project name for current experiment run. Default value of "default" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer the Google style docstrings that I had earlier, the type information is pretty helpful.
co2_tracker/co2_tracker.py
Outdated
if cloud.is_on_private_infra | ||
else "" | ||
) | ||
if cloud.is_on_private_infra: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be moved to a separate method, something like _prepare_persistence_data
for example. This will make the stop()
method shorter and more readable.
co2_tracker/emissions.py
Outdated
df: pd.DataFrame = self._data_source.get_cloud_emissions_data() | ||
|
||
# TODO: deal with missing data | ||
print(cloud.provider, cloud.region) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove print
statements
co2_tracker/emissions.py
Outdated
return ( | ||
_get_country_emissions_energy_mix( | ||
energy, geo, energy_mix_data_path=config.private_infra_energy_mix_path, | ||
class Emissions: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think pure functions are better here instead of this class. Reference. There is no real state here, I think data_source
can just be another argument
co2_tracker/emissions.py
Outdated
|
||
country_energy_mix: Dict = energy_mix[geo.country_iso_code] | ||
|
||
emissions_percentage: Dict[str, float] = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer dict()
instead of {}
co2_tracker/output.py
Outdated
posting to Json Box, saving to a database, sending a slack message etc. | ||
""" | ||
|
||
@abstractmethod | ||
def flush(self, data: CO2Data): | ||
def out(self, data: CO2Data): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think flush()
(which is used with the context of emptying a buffer) or persist()
is more descriptive
…meters, outputs and visualization
GitHub Pages Sphinx Documentation
No description provided.