Skip to content

ingest, attribute: --modulus/--residues shard the tiles, as harmonize and emit do - #17

Draft
danohu wants to merge 3 commits into
cornerstone-data:mainfrom
AdAstraEco:ingest-sharding
Draft

danohu wants to merge 3 commits into
cornerstone-data:mainfrom
AdAstraEco:ingest-sharding

Conversation

@danohu

@danohu danohu commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

harmonize and emit can split a backfill into disjoint shards of the sorted tiles, but ingest and attribute have to cover every tile in one process. This adds the same two flags to both, applied via utils.iter_sharded, so --modulus N --residues i picks the same tiles in all four CLIs.

ingest

  • Sharding happens in main() only; workflow() is unchanged.
  • As with the tile set itself, the shard only bounds tiled datasets: a whole-world dataset is still ingested over its one "world" tile, by every shard.

attribute

  • workflow() gains modulus/residues, which filter the tile -> countries map before anything is computed, so a sharded run returns only its own tiles' rows. A tile shared by two countries falls in one shard, so both its partials land together.
  • A per-tile job can compute that tile's cached partials; a later unsharded run merges them from the cache.

Defaults leave existing invocations and callers, including trace.workflow, unchanged. Also merges main to pick up #18.

Tests: jdluc/__tests__/ingest_test.py covers all tiles, one shard, a single tile and two shards. jdluc/__tests__/attribute_test.py covers every tile, each of two shards, and a tile shared by two countries. Neither needs a .env.

@danohu
danohu marked this pull request as draft October 15, 2026 18:23
harmonize and emit can split a backfill into disjoint shards of the sorted
tiles, but ingest has to cover every tile in one process. The same two flags,
applied to the same tile list, let an ingest backfill be split the same way:
`--modulus N --residues i` picks the same tiles in ingest as in harmonize and
emit.

As with the tile set itself, the shard only bounds tiled datasets: a
whole-world dataset is still ingested over its one "world" tile, by every
shard. Defaults leave existing invocations unchanged.
@danohu
danohu marked this pull request as ready for review October 15, 2026 19:34
…t and ingest

harmonize, emit and ingest can already be run for one shard of the sorted
tiles; attribute could only run every tile at once. With the same two flags,
`--modulus N --residues i` picks the same tile in all four CLIs, so a per-tile
job can compute that tile's cached partials, and a later unsharded run merges
them from the cache.

The shard filters the tile -> countries map before anything is computed, so a
sharded run returns only its own tiles' rows. Defaults leave existing callers,
including trace.workflow, unchanged.
@danohu danohu changed the title ingest: --modulus/--residues shard the tiles, as harmonize and emit do ingest, attribute: --modulus/--residues shard the tiles, as harmonize and emit do Oct 19, 2026
@danohu
danohu marked this pull request as draft October 21, 2026 06:49
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