perf: split nb06 into CI (fast) + research (full-fidelity) versions - #232
perf: split nb06 into CI (fast) + research (full-fidelity) versions#232jonathanhhb wants to merge 1 commit into
Conversation
Motivation: docs/tutorials/notebooks/06_SIR_wbirths_natural_periodicity.ipynb
accounts for ~16 of the ~40 minutes the Build Combined Doc workflow spends
executing notebooks — roughly 40% of the whole pipeline. Its heaviness comes
from a 10-simulation × 100-year sweep plus a 6-point regime-robustness sweep,
each at 100y. That fidelity is valuable for research but excessive for CI.
Two files where there was one:
- docs/tutorials/notebooks/06_SIR_wbirths_natural_periodicity.ipynb (in place)
Slimmed for CI:
• single-run sanity check: nticks 365*100 → 365*30 (100y → 30y)
• sweep: nsims 10 → 5, nticks 100y → 40y, added np.random.seed(42) so
the sampled (CBR, inf_mean, R0) tuples are reproducible across CI runs
• regime sweep: 6 CBRs → 4 (spanning both regimes: 15, 30, 60, 100),
nticks 100y → 40y
• peak-finder/autocorr `cutoff` default 18250 (50y) → 3650 (10y) so the
shortened windows still leave a usable post-transient analysis chunk
Expected nb06 execution: ~16 min → ~3–4 min. Whole build target: ~40 min → ~28 min.
- docs/tutorials/notebooks/research/06_SIR_wbirths_natural_periodicity.ipynb (new)
Verbatim copy of the pre-split notebook. Preserved for research use with
the original 100y × 10-sim × 6-CBR fidelity.
Wiring:
- Makefile: `NB_EXCLUDE` gains `research/` so docs/execute_notebooks.py
skips everything under any `research/` subtree.
- mkdocs.yml: mkdocs-exclude glob adds `tutorials/notebooks/research/*` so
the research copy is invisible to the rendered mkdocs site and nav.
- docs/tutorials/notebooks/research/README.md documents the pattern for
future maintainers (why the split exists, when to use which copy, what
wiring keeps them separate).
Verified on branch perf/split-nb06-ci-research (PR #230, which additionally
includes the plot-description work from PR #204 — this branch strips that
out to keep the change tight to just the nb06 split): Build Combined Doc
ran in 31m16s (was 41-43m), nb06 alone dropped from 16m05s to 3m39s.
The jenner-generic-mcp alpha suite still passes 20/21 against the resulting
corpus (same as pre-split baseline).
|
Closing — superseded by the combination of #233 (merged) and #237 (open). The nb06 wall-clock problem this PR was designed to fix is now solved twice over, without needing to split the notebook into separate CI/research files. Final resolution#233 (merged) — @YeChen-IDM's env-var toggle: a single #237 (open) — default Together those cover every case this PR was addressing:
What this PR uniquely offeredOnly one thing this PR added that #233 + #237 don't:
That's genuinely nice-to-have — if a future notebook has a "quick tutorial" version AND a "deep exploration" version that we want to keep in the repo but distinguish for CI, this wiring is the paved path. But nothing else needs it today, and it costs perpetual maintenance to keep two nb06 files in sync. Better to add the Diagnostic thread (for the record)The empirical benchmarking that ran alongside this PR revealed several unrelated things worth capturing here:
On the current shipping config (yechen's stripped Preserving the branch |
NOTE: This is a more ambitious version of #233. May not be needed immediately and represents a direction @JSchripsema-IDM has discussed. Needs more discussion before one-off-ing a single "science version" notebook.
Replaces #230 with the minimum change needed for the split.
Why
The Build Combined Doc workflow takes ~40 min today; ~16 min of that is executing
docs/tutorials/notebooks/06_SIR_wbirths_natural_periodicity.ipynb(the 10-sim × 100-year parameter sweep from #188 plus a 6-CBR regime-robustness sweep). That's roughly 40% of the entire pipeline.What changes (5 files)
docs/tutorials/notebooks/06_SIR_wbirths_natural_periodicity.ipynb— slimmed for CI:nticks100y → 30ynsims10 → 5,nticks100y → 40y,np.random.seed(42)added so CI runs are reproduciblenticks100y → 40ycutoffdefault 18250 (50y) → 3650 (10y) so trimmed windows still leave a usable post-transient chunkdocs/tutorials/notebooks/research/06_SIR_wbirths_natural_periodicity.ipynb(new) — verbatim copy of the pre-split notebook, preserved for research use at the original 100y × 10-sim × 6-CBR fidelity.docs/tutorials/notebooks/research/README.md(new) — documents the pattern for future maintainers.Makefile—NB_EXCLUDEaddsresearch/sodocs/execute_notebooks.pyskips anything under anyresearch/subtree.mkdocs.yml— mkdocs-exclude glob addstutorials/notebooks/research/*so the research copy is invisible to the rendered mkdocs site and nav.Verified
Superseded PR
#230 contained the same nb06-split changes plus the entire PR #204 plot-description sweep (150 files diff). This PR is scoped to just the nb06 split (5 files); #204 remains its own PR.
Caveat
Cached outputs in the CI nb06 are from a pre-split 100-year run — code shows 30y/40y but plot images still show 100y until the next release-publish build regenerates them (that workflow sets
MKDOCS_EXECUTE_NOTEBOOKS=true). Nothing crashes; the qualitative shape of every plot is unchanged.