Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Logger Output
New feature
Add two classes to output emissions data to loggers:
LoggerOutput()
: output to Python logging logger.GoogleCloudLoggerOutput()
: output to Google Cloud Logging. This sends emissions data of tracked scripts/workloads to some project Cloud LoggingEmissions data are logged as a JSON record, on
tracker.stop()
See
Collecting emissions to a logger.md
for additional explanations & examples.Files modified
codecarbon/output.py
: add new classescodecarbon/emissions_tracker.py
: add arguments for saving to loggersNote:
.pre-commit-config.yaml
has been updated to black 22.3.0 since version 21 is broken by click 8.1.Files added
tests/test_logging_output.py
:LoggerOutput
test caseexamples/logging_demo.py
: example to demonstrate usage from the command lineCollecting emissions to a logger.md
: explanations & examplesMisc
pre-commit has been applied.
Roadmap