Repository navigation
Conversation
Author
|
Closing this one since #1472 already landed the same change, and more completely than mine. Congrats @PRINCE2-AI, and thanks to the maintainers for the quick turnaround. |
Contributor
|
Thanks, @Ptraaah — and for the record you opened yours about 20 minutes before mine, so this was timing rather than speed on my end. Appreciate you closing it cleanly instead of leaving two PRs open against the same issue. Pointing people at the "Track any command" section was the right call; the only thing I had on top was a regression test so the help text can't silently disappear again. |
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.
Description
codecarbon monitor --helpused to show a single line ("Monitor your machine's carbon emissions.") plus the option list. Nothing in the terminal said that the same command can also wrap another command, even though the web tutorial has a whole "Track any command" section explaining it.This PR expands the docstring of the
monitorcommand incodecarbon/cli/main.py, which is what Typer prints for--help. The help now explains both ways to use the command:codecarbon monitormonitors the whole machine until Ctrl+Ccodecarbon monitor -- <command>tracks one command instead, with examples (python train_model.py,./benchmark.sh), the reminder not to quote the command and to put CodeCarbon options before the--, and what happens at the end (only the command process and its children are tracked, a summary report is printed, and the data is appended toemissions.csvin the current directory)The wording follows the existing tutorial page and the
run_and_monitordocstring incodecarbon/cli/monitor.py, and I checked every claim against that function's behaviour. No code logic changes, help text only.Related Issue
Closes #1470
Motivation and Context
A user who discovers the CLI through
--help(for example viauvx codecarbon monitor --help, as in the issue) currently has no way to learn about the command-tracking form without leaving the terminal for the website. The feature is arguably the most useful part of the CLI, so it should be visible where people look first.How Has This Been Tested?
codecarbon monitor --help: the new text renders as intended, examples included.pytest tests/cli/test_cli_main.py tests/cli/test_monitor.pygives 46 passed.ruff format --check codecarbon/cli/main.pypasses, and the change adds no new lint findings (the ones ruff reports elsewhere in the file are pre-existing on master).No new tests: this is help text only, and the existing CLI tests already cover the
monitorbehaviour described.Types of changes
Documentation improvement only (none of the boxes below really fit, it changes no behaviour):
Checklist: