Resumable Runner
Overview
A Python library and CLI that runs a function over many items. Stop any time, rerun to resume.
While collecting place, menu and review data for hundreds of thousands of outlets during a data internship,
I built cache, resume, retry and status tracking. This project rebuilds them as a small, dependency-free tool.
It contains no company code or data.
Skills
- Python, SQLite
- pytest, Ruff, mypy, GitHub Actions, uv
Design
Resuming after a crash
Problem
With a plain crawling loop, a crash meant starting over from the beginning.
Solution
Every item lives in one SQLite file, and each status change (pending, running, done, failed) is committed right away.
On the next run, items left running go back to pending, and finished items are skipped.
Retrying and stopping safely
Problem
Every script reinvented its own retry logic,
and a blocked site produced thousands of failures in a row.
Solution
Failures are retried with exponential backoff, with a minimum interval between calls.
After N failed items in a row, a circuit breaker stops the run and leaves the rest pending.
Easy to drive from scripts
The run, status, retry and export commands support --json output and fixed exit codes,
so scripts, CI jobs and LLM agents can drive them.
Quality
- 52 unit and CLI tests passing, 97% coverage
- No issues in mypy strict mode or Ruff
- CI on GitHub Actions for Ubuntu and Windows, Python 3.11 to 3.13
- Backoff and throttling are tested with a fake clock, so the whole suite runs in about 2 seconds.
Comments