Skip to main content

Module checkpoint

Module checkpoint 

Source
Expand description

Checkpoint system for resilient pipeline execution.

Provides checkpoint, checkpoint_get, and checkpoint_clear builtins. Checkpoints are persisted to <state-root>/checkpoints/<pipeline>.json and survive pipeline crashes/timeouts. On resume, a pipeline can skip already-processed items by checking checkpoint_get.

The per-pipeline state is per-thread: register_checkpoint_builtins installs a fresh [CheckpointState] into a thread-local cell so the #[harn_builtin]-emitted handler fns can read/mutate it without capturing closures (which would block the macro path). Each VM that registers checkpoint builtins overrides the cell for its thread — since the Harn VM is single-threaded per execution, this is the intended scoping (each pipeline run installs its own state once at VM setup, then the handlers see it for the duration of the run).

Functions§

register_checkpoint_builtins
Register checkpoint builtins on a VM.