Skip to content

12.1: save and restore pipeline - #16

Merged
MathisWellmann merged 3 commits into
mainfrom
save-restore
Nov 12, 2026
Merged

MathisWellmann merged 3 commits into
mainfrom
save-restore

Conversation

@MathisWellmann

Copy link
Copy Markdown
Owner

No description provided.

A live process that computes features must save their state with its
input position and continue after a restart. Without saved state it can
only replay recent history, and filters with infinite memory (ema,
kalman, cusum, bocpd, ...) and running sums then give other values than
a run without the restart, so backfill and live features differ.

The serde feature derives Serialize and Deserialize for every view.
Serde covers arrays of up to 32 elements only, so the two 50-element
arrays of the Hilbert transform views use a small serde_array helper.
Tests save views with bincode at many points and check that they
continue with the same bits as views that run without a break. CI also
runs the tests with all features, because the default run skips them.
A process that computes features from a pipeline must continue after a
restart with the same values as without it, so that backfilled and live
features agree. Pipeline::save_state returns a PipelineState: the states
of the views, the last values, and the identity of the pipeline (its
inputs in order and its canonical text). Pipeline::restore_state
continues from it in a pipeline compiled from the same text. It rejects
a state of another pipeline, of another format or with other operations
and then leaves the pipeline unchanged. Feature delegates to both.

The program is not saved with the state, because the caller's text is
the source of truth, and a saved program could carry indices that do not
fit. With the serde feature PipelineState is serializable.

Tests move a pipeline that calls every function at two parameter sets to
a fresh pipeline compiled from its text, after every update and at
longer steps, in memory and through bincode, and check every output bit
for bit. The README documents the API and why the format must keep f64
exact and NaN.
@MathisWellmann MathisWellmann self-assigned this Nov 12, 2026
@MathisWellmann
MathisWellmann merged commit 3cc60d4 into main Nov 12, 2026
1 check passed
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