perf: speed up CLI monitor startup and fix wrapped commands (4/4)#1254
Open
davidberenstein1957 wants to merge 1 commit into
Open
Conversation
This was referenced Jun 21, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## davidberenstein1957/perf-3-lazy-api-run #1254 +/- ##
===========================================================================
+ Coverage 89.28% 89.35% +0.06%
===========================================================================
Files 48 48
Lines 4761 4771 +10
===========================================================================
+ Hits 4251 4263 +12
+ Misses 510 508 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Collaborator
Author
5fc6acd to
e933dea
Compare
a85be35 to
07b82eb
Compare
Lazy-import heavy CLI dependencies, add --log-level to monitor, and strip nested monitor/-- tokens when delegating to wrapped user commands. Co-authored-by: Cursor <cursoragent@cursor.com>
07b82eb to
928621d
Compare
e933dea to
11f3f20
Compare
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
Part 4/4 of the tracker performance stack. Depends on #1251 → #1252 → #1253.
cc @inimaz — final CLI layer of the #1246 split. Merging #1251 → #1252 → #1253 → this PR restores the full change set.
Speeds up
codecarbon monitorstartup and fixes wrapped-command delegation:questionary,requests, tracker classes, etc.)--log-leveloption tocodecarbon monitor(default:error)monitor/--tokens before exec--log-leveldefaultBenchmarks (measured locally, offline Mac ARM, 2026-06-21)
Full stack cumulative vs
master:__init__p50init→start→stop)Stack
CI / quality
pre-commit run --all-files— passed (autoflake, isort, black, flake8)pytest tests/cli/— 59 passedCODECARBON_ALLOW_MULTIPLE_RUNS=True pytest --ignore=tests/test_viz_data.py -m 'not integ_test' tests/)Test plan
codecarbon monitor --offline --country-iso-code FRA -- sleep 1codecarbon monitor --offline --country-iso-code FRA --log-level debug -- python train.pyReplaces
Split from #1246.