Repository navigation
Commit 710debe
Split the artifact and Stage 12 cache precompute modules
precompute.py (931 lines), stage12_cache/precompute.py (844 lines) and
tests/test_precompute.py (1,835 lines) were over the file-length limits.
The code moves unchanged.
Each precompute module keeps its manifest functions, its functions
dataclass and run_precompute, and re-exports every public name in
__all__, so the Modal precompute apps, which import the step functions
from it when they run, are unchanged. The steps move to three modules
next to it:
- precompute_planning.py: cohorts or baseline identities, the state
dataset targets, plan_artifacts_impl and select_work
- precompute_datasets.py: the national and per-state dataset builds
- precompute_baselines.py: computing the baselines and checking that
they are deterministic
Private names another module now uses are public: the artifact
precompute's _cohort_resolution, and the cache precompute's
_scoped_planned_simulation (with a new docstring) and _baseline_identity.
stage12_worker_validation.py imports scoped_planned_simulation from the
cache's precompute_planning.py.
tests/test_precompute.py keeps the schema, planning and orchestration
tests; the rest move to test_precompute_planning.py,
test_precompute_datasets.py and test_precompute_baselines.py, all 71
tests unchanged apart from patch targets. Each patch now targets the
module whose code reads the name: the planning tests patch
state_dataset_targets and cohort_identity in precompute_planning, the
state dataset tests patch state_dataset_targets in precompute_datasets,
and the determinism tests patch _prepare_cohort_baseline in
precompute_baselines. In the cache tests, the planning fixture and the
state-target test patch precompute_planning, the state build fixture
patches precompute_datasets, the determinism tests patch
precompute_baselines, and the store helper replaces Stage12CacheStore
in all four modules, each of which opens the store.
The file-length baseline drops the three files (count 7 to 4).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>1 parent 488a681 commit 710debe
18 files changed
Lines changed: 2910 additions & 2656 deletions
File tree
- docs/generated
- projects/policyengine-simulation-executor
- src/policyengine_simulation_executor
- stage12_cache
- tests
- rules
- baselines
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| |||
0 commit comments