Checkpoints
Checkpoints let DataChain skip work that was already done in a previous run and recover from failures. When you re-run a script, DataChain detects which datasets and Python operation results were already created and reuses them instead of recomputing. If a Python operation fails mid-execution, you can fix the bug and re-run - only the remaining rows are processed.
Example
Save this as process.py:
First run (python process.py): Processes some files, then crashes on a cat image.
Fix the bug - edit process.py:
Second run (python process.py): Skips already-processed rows and continues with the fixed code. No progress is lost.
Third run (python process.py): DataChain detects that processed_files was already created with the same chain. It skips everything:
What Invalidates Checkpoints
Checkpoints are tied to the chain's operations. Any change produces a different hash and triggers recomputation:
- Changing filter conditions, parameters, or output types
- Adding, removing, or reordering operations in the chain
- Changing the source data (e.g. reading from a new dataset version)
- Modifying Python operation code after a successful completion
Exception: If a Python operation failed mid-execution and you fix the code (without changing the output type), DataChain continues from partial results instead of restarting. If you change the output type, partial results are discarded and the Python operation reruns from scratch.
How to Use
Checkpoints work automatically when running Python scripts:
In Studio UI, you can choose between Run (ignores checkpoints) and Resume (continues from last checkpoint) when triggering a job.

Checkpoints are not used in:
- Interactive sessions (Python REPL, Jupyter notebooks)
- Module execution (
python -m mymodule)
To force a fresh run ignoring existing checkpoints:
More Examples
Changing one chain doesn't affect others
Save this as multi_chain.py:
Run it twice - both chains are reused on the second run. Now change the filter in chain 1 (e.g. > 20000) and run again. Chain 1 is recomputed, but chain 2 is reused - its chain is untouched.
Generator recovery
Save this as gen_tags.py:
Generators (.gen()) that yield multiple rows per input also support partial recovery. If extract_parts crashes mid-execution, the next run continues from where it stopped - already-processed inputs are skipped, and incomplete inputs are re-processed.
What recomputes and what doesn't
Recomputes - changing a filter:
Recomputes - changing Python operation code after successful completion:
Does NOT recompute - fixing a bug after a crash:
Does NOT recompute - changing an unrelated chain:
Limitations
- Script path matters: DataChain links runs by the script's absolute path. Moving the script breaks checkpoint linking.
- Threading/multiprocessing: Checkpoints are automatically disabled when Python threading or multiprocessing is detected. DataChain's built-in
parallelsetting for Python operations is not affected. - Unhashable callables: Built-in functions (
len,str), C extensions, andMockobjects produce a different hash on each run, so checkpoints using these as Python operations will always recompute. Use regulardeffunctions or lambdas instead.