Umbrella issue for a set of changes making the codecarbon client cheaper to run and cheaper to install. Each item is a separate, independently reviewable PR; this issue only tracks them.
Checklist
Overlap to resolve before reviewing
#1324 (fix: stop PeriodicScheduler from re-arming itself after stop()) and #1339 fix the same scheduler defect by different means. #1324 is a narrow fix to the existing chained-Timer design; #1339 replaces that design with a single daemon thread. Please pick one before reviewing — merging both, or reviewing them independently, means duplicated work and a conflicting merge.
Out of scope, decided against
- Client-side batching of emissions. The
/emissions/batch endpoint does not exist — carbonserver has only the single-row POST /emissions — so the batch path would be dead code that always 404s and falls back to the loop it replaced. Should land together with the server-side endpoint, or not at all.
- A disk spill buffer in
ApiClient. Retries cover transient failures, which is the overwhelming majority of them. A spill buffer adds write-failure surface to the measurement path and, being off by default, is code nobody exercises until it is needed and broken. Worth building when someone actually reports losing data across a restart.
- Moving the CLI and auth dependencies into extras. Worth about 23 MB with no runtime benefit, and it breaks
pip install codecarbon && codecarbon monitor, a documented headline feature.
Before/after measurements for each item live in the corresponding PR description rather than here, so they stay next to the code they describe.
Umbrella issue for a set of changes making the
codecarbonclient cheaper to run and cheaper to install. Each item is a separate, independently reviewable PR; this issue only tracks them.Checklist
refactor(scheduler): run ticks on one daemon thread instead of chained Timers. Stops the scheduler re-entering its own callback when a measurement outlasts the interval, and stops it re-arming afterstop().feat(api): reuse connections and retry transient API failures. Adds aSession, a retry policy and a run-creation herd guard, instead of one connection per request with failures logged away.fix(api): stamp emissions with measurement time, not send time. See API emissions are timestamped at send time, not measurement time #1312.ci: test every Python version the package promises. The matrix skips 3.10 and 3.11, which the classifiers advertise; also adds a bare-install wheel smoke job.perf(deps): drop pandas and numpy from the default install.Overlap to resolve before reviewing
#1324 (
fix: stop PeriodicScheduler from re-arming itself after stop()) and #1339 fix the same scheduler defect by different means. #1324 is a narrow fix to the existing chained-Timerdesign; #1339 replaces that design with a single daemon thread. Please pick one before reviewing — merging both, or reviewing them independently, means duplicated work and a conflicting merge.Out of scope, decided against
/emissions/batchendpoint does not exist —carbonserverhas only the single-rowPOST /emissions— so the batch path would be dead code that always 404s and falls back to the loop it replaced. Should land together with the server-side endpoint, or not at all.ApiClient. Retries cover transient failures, which is the overwhelming majority of them. A spill buffer adds write-failure surface to the measurement path and, being off by default, is code nobody exercises until it is needed and broken. Worth building when someone actually reports losing data across a restart.pip install codecarbon && codecarbon monitor, a documented headline feature.Before/after measurements for each item live in the corresponding PR description rather than here, so they stay next to the code they describe.