Repository navigation
Write and count bundle rows per package instead of holding them all - #414
Conversation
build_bundle kept every source package's consumer rows in one list until the end, grouped all of them by fact key, then wrote and counted them. Held rows cost about 7.6 KB each, so main's 1.66M rows peaked at 15.4 GB on CI's 16 GB runner, and chronicle#408's fifth more facts no longer fit. Each package's rows are now appended to consumer_facts.jsonl.partial and added to a running coverage count as they are read, then freed with the package's suite report before the next package builds. The file takes its final name at the end. _BundleCoverage keeps counts, distinct identities and each fact key's first source table and legacy key, so duplicate reports need no rows. build_bundle_coverage keeps its signature and output, and the metadata pool is per package. On a nine-package subset the four bundle outputs are byte-identical to main's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#414 writes and counts each package's rows as it reads them, so the bundle no longer holds every row at once. The 16 GB CI runner could not fit this branch's bundle without it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This PR's CI bundle step peaked at 3,583,520 KiB (3.4 GiB) for the default bundle's 1.74M facts, against 15,728,820 KiB (15.0 GiB) on main's run at the base, 6475380. The UK suite built on one Mac went from 12.8 to 4.0 GiB max RSS, with all four outputs byte-identical. The changelog's earlier 15.4 GB divided GNU time's KiB by a million; the figures here are GiB. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The bundle job now fits on the runner (3,578,392 KiB peak with #414's streaming build) and failed only on the pinned counts. The new pins come from that run's uploaded reports: 326,495 facts, 12 packages and source tables, 275 geography keys and 46 period keys. Each change is attributed per package from the packages' own facts reports, and the attributions sum to the bundle's changes. Semantic duplicate keys (2,324) and warnings are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review of 511b857. I read the diff against the base (6475380, current main) side by side with the old Should
Nit
Checked and fine
CI at 511b857: all green. The bundle job passed in 2h54m56s and the surface job in 1h42m. The last four bundle runs on main took 1h51m to 2h55m (2h33m at the base 6475380), so the 2h55m is within main's spread. It isn't evidence that streaming slows the build. The fix looks right, and I found nothing that weakens a cross-package check. Item 1 is the only gap I'd close before this leaves draft. 🤖 Generated with Claude Code |
…artial file Review on #414: - test_bundle_coverage_duplicates_keep_each_keys_first_row pins the whole duplicate report for a key on three rows. The first row alone carries one of the two source tables and one of the two legacy keys, and a semantic key's first row has no legacy key. Main's build_bundle_coverage (6475380) gives the same coverage for these rows. - build_bundle removes consumer_facts.jsonl.partial if anything raises before the rename, so a failed build leaves no facts file, as before. test_build_bundle_removes_its_partial_facts_file_when_it_fails fails on 511b857's build. - The comment and docstring give CI's measured 15.0 GiB for 1.74M rows, as the changelog and the PR description do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks, Vahid. All three are addressed in b71d03d, pushed together with 36835ab.
Locally, |
|
Round 2 at b71d03d. I read the diff from 511b857 (36835ab and b71d03d) against
No new findings. Moving the shared stub into CI at b71d03d: still pending. Both the bundle and surface jobs started at 12:07 UTC, and the bundle job usually takes about 3h. So the two new tests and the pinned whole-bundle counts haven't yet passed at this head. Nothing more from me once CI is green. 🤖 Generated with Claude Code |
build_bundleheld every source package's consumer rows until the end of the build. It kept them in one list, grouped all of them by aggregate and semantic fact key, and only then wrote and counted them. Held rows cost about 7.4 KiB each (276,703 rows took 2.0 GiB to load), so the default bundle's 1.74M rows took about 12 GiB just to hold. On CI, main's bundle step peaked at 15.0 GiB at this PR's base, close to the runner's memory. #410 adds about a fifth more facts, and its bundle job was shut down twice. #410 is stacked on this PR.What changes
consumer_facts.jsonl.partialand added to a running coverage count as soon as they're read. The rows and the package's suite report are then freed before the next package builds.consumer_facts.jsonlonce every package is in, so an interrupted build never leaves a partial facts file under the final name._BundleCoveragekeeps the coverage counts and each identity's distinct values. For each aggregate and semantic fact key, it records where the first row came from: its source table and legacy key. Only keys seen again collect more, so duplicate reports need no rows.build_bundle_coverage(rows)keeps its signature and output, and uses the same counter.Memory
Figures are peak resident memory (max RSS) in GiB.
build-bundle --suite uk, 1,585,295 facts, 309 packages). It peaked at 4.0 GiB, against 12.8 GiB for main 6475380, built with the same command on the same night. Python's own peak footprint was 3.7 GiB.What stays the same
consumer_facts.jsonl(7,993,174,294 bytes) matches the facts file of main's UK consumer artifact, sha256bcb226fd….build-consumer-artifactwrites that file from the bundle's.coverage.json,source_packages.jsonandreports/build_bundle.jsonmatch main's. Main's bundle folder was deleted before the comparison, so I rebuilt these three from its logged build report with the bundle's own writer. The rebuilds match the original files' sizes.KeyErrorwhen duplicates are computed, as it did when every row was grouped by its key.Tests
test_build_bundle_frees_each_packages_rows_before_the_next_buildsbuilds two packages that share a fact. It checks three things:Run against main's
build_bundle, it fails: both of the first package's rows are still held when the second builds.CI's bundle job: 33 passed, the whole-bundle test included.
Locally,
tests/test_chronicle_bundle.pywithout the whole-bundle test: 32 passed. The 19 package test files that callbuild_bundle_coverage: 3,668 passed.🤖 Generated with Claude Code