Skip to main content

Module streaming_restart

Module streaming_restart 

Source
Expand description

Eager → --streaming restart policy shared by the CLI and cortex_worker (batches 56dw/56dz): when to stream up front (resolve_streaming, the source-size projection), where an eligible eager run stops to rerun (restart_watermark, nine tenths of the memory fuse), whether a finished eager attempt asks for the rerun (restart_budget), and the memory release the rerun needs first (release_before_rerun).

Functions§

note_restart_signal
Test seam: pretend digestion stopped for memory on this thread.
projected_source_bytes
The byte size the memory projection must reason from: the DOCUMENT, not the main file.
release_before_rerun
Give the fused attempt’s memory back before the rerun’s first fuse check: its boxes still sit in the stomach’s lists and its freed pages in mimalloc’s heap, so the rerun read the OLD peak and fused again (807 MB against an 805 MB cap half a second in). Returns the resident size after the release and the fuse, both in MB; the caller reruns only when the first is below the second.
resolve_streaming
Streaming activation (user policy 2026-07-29: flag + auto-when-doomed).
restart_budget
After an eager attempt on this thread: the fragment budget to rerun under when digestion stopped for memory — at the watermark or at the fuse. Takes the signal, so a later paper on the same thread starts clean. None = keep the eager result.
restart_watermark
The RSS at which an eligible eager run stops to rerun under --streaming: nine tenths of the cooperative fuse in force for this thread. The stop exists for clean reporting (an Info instead of a Fatal, no salvage of a partial document) more than for time: sweep #104 put it at two thirds and five documents whose eager peak sat between the watermark and the fuse paid a needless rerun (+330 s of sweep wall, no verdict changed), while the witnesses that fuse anyway saved little (pgf-PeriodicTable’s manual is bounded by its ~380 s streaming rerun, not by where the eager attempt stops). None when memory limiting is disabled (--max-memory=0): the single knob governs every ceiling.
transition_budget
The box budget a mid-run eager→streaming transition (digest_adaptive) hands to pass 1: the same yardstick resolve_streaming uses — the resolved RSS cap when one is set, else this machine’s default ceiling — over the per-box footprint. Never None: the transition happens BECAUSE memory is under pressure, so the budget must be finite.