Skip to content

Scaling the client: scheduler re-entrancy, API delivery, install weight, CI coverage #1338

Description

@davidberenstein1957

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions