Skip to content

perf: stream runner artifact hashes with bounded memory - #86

Open
Afloat16 wants to merge 1 commit into
billion-token-one-task:masterfrom
Afloat16:perf/stream-runner-artifact-hashes-20261202-r2
Open

Afloat16 wants to merge 1 commit into
billion-token-one-task:masterfrom
Afloat16:perf/stream-runner-artifact-hashes-20261202-r2

Conversation

@Afloat16

@Afloat16 Afloat16 commented Dec 2, 2026

Copy link
Copy Markdown

Problem

The runner, metric verifier, and artifact registry hash files through Path.read_bytes(). Each verification allocates the entire raw prediction artifact before hashing it, adding a file-sized memory peak to research jobs and controller workers even though JSONL metric loading already operates line by line.

Changes

Share a one-megabyte chunked SHA-256 reader through the runner contract module and use it at all three runner artifact hashing boundaries. Preserve the exact existing SHA-256 digest and mismatch behavior. The helper travels in the existing materialized runner contract module, so portable bundles need no additional dependency.

Validation

  • 3 failed, 4 passed on base.
  • Real 16 MiB JSONL artifacts: Python temporary-allocation peaks measured by tracemalloc during these hashing-containing calls fell from 16.78–16.79 MB to 2.10–2.12 MB across runner, metric verification, and registry paths (about 87% lower temporary allocation in this fixture).
  • Controls cover empty/binary files, a partial final chunk, successful metric verification/registration, and tampering refusal.
  • python -m pytest -q -s tests/test_runner_artifact_hash_memory.py tests/test_runner_contract_and_failure_policy.py: 43 passed, 26 subtests passed.

These measurements are not process RSS or whole-pipeline memory. This bounds hashing memory; decoded prediction rows still consume memory according to the existing metric implementation.

@cla-assistant

cla-assistant Bot commented Dec 2, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

1 participant