pelinker.checkpoint¶
Shared machinery for resumable search checkpoints.
model_selection, dim_selection and scale_curve each keep their own
checkpoint dataclass, because their keys genuinely differ (a fused combination, a
(pca, umap) cell, a sample-size rung) and their on-disk field names must stay
stable for already-written state files. Everything that does not depend on those
names lives here: the version constant, the timestamp, the run fingerprint, the
atomic gzip-aware read/write, and the fingerprint fields all three searches share.
FailureRecord
dataclass
¶
compute_run_fingerprint(config)
¶
sha256 of the canonicalized run config; a change invalidates the checkpoint.
Source code in pelinker/checkpoint.py
read_checkpoint_json(path)
¶
Load a checkpoint payload (plain or gzipped) and assert it is an object.
Source code in pelinker/checkpoint.py
shared_fingerprint_fields(*, cluster_viz_method, min_class_size, seed, pca_seed, umap_seed, clustering_sample_rows, batch_size, n_sample, selected_labels_kb_path, max_scale, min_scale=None, clustering_grid_step=5, negative_label=NEGATIVE_LABEL, screener_kind='lda', drop_rare_entities=False, min_mentions_per_entity=20, max_mentions_per_entity=None, max_mentions_negative=None, mention_cap_seed=13)
¶
The fingerprint fields common to every search; callers add their own on top.
min_scale is resolved here to the same default
:meth:~pelinker.config.ClusteringOptimizationConfig.resolved_min_scale uses, so
an explicit min_scale equal to the default does not change the fingerprint.
Source code in pelinker/checkpoint.py
write_checkpoint_json_atomic(path, payload)
¶
Write via *.tmp + replace so a crash never leaves a torn checkpoint.