perf: defer API run creation until first emission upload (3/4)#1253
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-2-hardware-cache #1253 +/- ##
==========================================================================
Coverage 89.27% 89.28%
==========================================================================
Files 48 48
Lines 4757 4761 +4
==========================================================================
+ Hits 4247 4251 +4
Misses 510 510 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Collaborator
Author
1f759d9 to
9d1c656
Compare
a85be35 to
07b82eb
Compare
Skip POST /runs during tracker startup and create the run lazily on the first live_out/out call when an experiment id is configured. Co-authored-by: Cursor <cursoragent@cursor.com>
9d1c656 to
00817d8
Compare
07b82eb to
928621d
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 3/4 of the tracker performance stack. Depends on #1251 → #1252.
cc @inimaz — small, isolated API write-path change from the #1246 split.
Defers the
POST /runsAPI call until the first emission is actually uploaded, so online trackers with API output enabled no longer block on run creation during startup:CodeCarbonAPIOutputusescreate_run_automatically=False_ensure_api_run()creates the run lazily on firstlive_out/outcallBenchmarks (measured locally, offline Mac ARM, 2026-06-21)
Mocked geo/cloud/API network; measures
EmissionsTracker(save_to_api=True)coldstart():start()avgPOST /runsat startup__init__/ warm lifecycleStack
CI / quality
pre-commit runon all changed files — passedpytest tests/output_methods/test_http.py— 9 passedTest plan
Replaces
Split from #1246.