Skip to content

Python(feat): batch measurement upload - #810

Merged
alexluck-sift merged 8 commits into
mainfrom
al/python/feat/batch-measurements
Oct 19, 2026
Merged

alexluck-sift merged 8 commits into
mainfrom
al/python/feat/batch-measurements

Conversation

@alexluck-sift

@alexluck-sift alexluck-sift commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Replaying a test-results log batches consecutive measurement creates into one CreateTestMeasurements call instead of one call per measurement. On a 13,631-line log this cut the calls from 13,628 to 4,021 and the upload from about 12 minutes to about 3.5; step creates and updates still take one call each.

  • A crash mid-upload now loses up to one batch (100 measurements) of progress instead of one, in exchange for the fewer round trips.
  • A batch create that fails with an ambiguous gRPC status (the response was lost, not necessarily the request) is retried safely: the retry checks the server by test step, name, timestamp, and value before recreating anything, and reports the recovery once per run via the new SiftReplayReconciledWarning.
  • At session end pytest now waits up to 120s (was 30s) for the background upload and prints a notice while it waits. A worker still running after that is asked to stop after its current request (SIGTERM, or a <log>.stop file on Windows) so its progress is saved, and is killed only after a further 30s.

@alexluck-sift
alexluck-sift changed the base branch from main to al/python/fix/pytest-update-with-no-mask October 1, 2026 00:40
@alexluck-sift
alexluck-sift added this pull request to stack #811 October 1, 2026 00:40
Base automatically changed from al/python/fix/pytest-update-with-no-mask to main October 1, 2026 16:55
A test-results log records one CreateTestMeasurement line per measurement, and
replay sent one request for each. Measurements are the bulk of a log, so a
large log took one round trip per measurement to upload.

Replay now coalesces a run of consecutive measurement lines into one
CreateTestMeasurements call. A run ends at the next non-measurement line, at
the size guard, or at the end of the log, so lines still reach the server in
log order and the cursor advances by the whole run once its call returns.

On a 13,631-line log this takes the requests from 13,628 to 4,021, and the
upload from about 12 minutes to about 3.5 at a 53ms round trip. The sidecar is
written once per run rather than once per line, which cuts its cost with them.

The log format does not change, so a log written by an earlier version gets the
same speedup. Step creates and updates still take one request each.
@alexluck-sift
alexluck-sift force-pushed the al/python/feat/batch-measurements branch from 658e6a3 to 07f59ad Compare October 14, 2026 18:43
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Python docs preview: https://sift-stack.github.io/sift/python/pr-810/

Deployed from 57633e0. The link may take up to a minute to become live as GitHub Pages propagates.

@alexluck-sift alexluck-sift changed the title Al/python/feat/batch measurements Python(feat): batch measurement upload Oct 14, 2026
@alexluck-sift
alexluck-sift marked this pull request as ready for review October 15, 2026 21:51
Comment thread python/changelog.d/810.feat.md
Comment thread python/lib/sift_client/_internal/low_level_wrappers/test_results.py
Comment thread python/lib/sift_client/util/test_results/context_manager.py Outdated
@alexluck-sift
alexluck-sift merged commit b5ab9e8 into main Oct 19, 2026
27 of 28 checks passed
@alexluck-sift
alexluck-sift deleted the al/python/feat/batch-measurements branch October 19, 2026 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants