feat(cli): expose tracker options on codecarbon monitor - #1421
Open
HarshRajSinghania wants to merge 1 commit into
Open
HarshRajSinghania wants to merge 1 commit into
HarshRajSinghania wants to merge 1 commit into
Conversation
Generate additional `codecarbon monitor` flags from BaseEmissionsTracker.__init__ so options such as --pue and --wue stay in sync with the package API. Fixes mlco2#1273
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Generate additional
codecarbon monitorflags fromBaseEmissionsTracker.__init__so CLI options such as--pueand--wuestay aligned with the package API.Motivation
Fixes #1273.
codecarbon monitor --helppreviously exposed only a small subset of tracker settings. The issue asked for a dynamic implementation that stays synchronized with the tracker constructor.Implementation
codecarbon/cli/tracker_options.pyto inspect simplestr/int/float/boolconstructor parameters and publish matching Typer flags.monitoroptions (--offline,--api, measure interval, log level, country/region)..codecarbon.configandCODECARBON_*values are not overwritten.logging_logger,output_handlers,output_methods).Testing
Ran:
Result: the new tests passed (4 in
test_tracker_options.py) plus the existing offline tracker initialization test.Also invoked
codecarbon monitor --helpvia Typer'sCliRunnerand confirmed--pue,--wue, and--force-cpu-powerappear.Some other tests in
tests/cli/test_cli_main.pyfailed in this environment because optional packages such asprometheus_clientwere not installed; those failures look unrelated to this change.Notes
Complex constructor arguments that cannot be expressed as a single flag are intentionally omitted.