A video workflow can finish its script and narration, then stop during assembly. Restarting every stage wastes work. Reusing every file because it exists can quietly carry an outdated script into a new result. A checkpoint needs enough information to distinguish those cases.
VidPipe's documented task graph checks input fingerprints and artifacts before reusing completed work. This note isolates that design question in a small Python exercise. Its outputs are JSON files, so you can inspect the mechanics without installing a model or rendering a video.
Give reuse a clear contract
A stage is reusable only when its current inputs match the recorded fingerprint and its output still matches the recorded content hash. A filename alone proves neither. Include the stage's version and the dependencies that affect its result in the input fingerprint.

reusable = (
recorded_input_hash == current_input_hash
and output_file_exists
and recorded_output_hash == current_output_hash
)
The example has three stages: plan, narration, and package. Each fingerprints its stage name, version, brief, and the previous stage's output digest. A change upstream becomes an input change downstream. In a larger graph, record all relevant dependencies and model, prompt, or renderer versions as needed.
Run the interruption and recovery example
Standard library only. The script works in a temporary folder and makes no network calls.
Download the checkpoint example ↗Inspect the complete Python source ↗Extract the ZIP and run:
python resume_pipeline.py
The exercise checkpoints two stages and raises a controlled interruption. The next run reuses those stages and creates the package. It then damages the narration artifact and runs again. Finally, it changes the brief.
{
"interruption": "Stopped after checkpoint: narration",
"resume": [
"plan: reused",
"narration: reused",
"package: built"
],
"after_damage": [
"plan: reused",
"narration: built",
"package: reused"
],
"changed_brief": [
"plan: built",
"narration: built",
"package: built"
]
}
A repair does not always invalidate everything
After damage, the example rebuilds narration but reuses the package. That is intentional: the deterministic repair produces the same valid narration bytes, so the package's input fingerprint still matches. If the repair produced different content, its new digest would invalidate the package.
Changing the brief rebuilds all three stages. Removing an output also prevents reuse. These are separate failure cases and belong in separate checks; one successful resume does not demonstrate that stale outputs are handled correctly.
Write the artifact before its checkpoint
The script writes each output to a temporary file, replaces the stage artifact, and then replaces the state file. If execution stops before the new state is recorded, a later run can rebuild that stage. It must not claim a completed output that was never written.
This is a local, single-process teaching example. It has no locking, distributed leases, power-loss durability guarantee, or recovery from corrupt checkpoint JSON. Concurrent workers and external side effects require additional coordination and idempotency. A hash also checks consistency, not whether a video looks or sounds good.
Keep validity separate from quality
A valid file can still contain an awkward edit or incorrect narration. In VidPipe's production workflow, reuse checks sit alongside review and quality gates. This example illustrates checkpoint mechanics; it is not footage, a benchmark, or an export of the full private implementation.
For another reliability boundary, see preserving useful results when only some sources respond. Python's hashlib and pathlib references cover the standard-library operations used here.
BACK TO THE NOTEBOOK