What happens when your Python data pipeline crashes at step 19 out of 20 due to an unhandled network timeout or pod preemption? In naive scripts, you re-run from scratch, burning compute and duplicating side-effects.
WPipe v2.2.0 introduces Smart SQLite Checkpoints (WAL mode) to guarantee zero data loss and automated step-level resume.
This is Day 03 of the WPipe Open-Source Engineering Series (MIT, Python 3.9–3.14).
The Problem with Naive Workflows
- All-or-Nothing Execution: Crashing near completion discards all intermediate state.
- Circular Reference Failures: Standard pickling crashes when pipeline contexts contain complex object graphs.
- Heavy Infrastructure Overhead: Pulling in heavyweight orchestrators just to get persistent checkpoints overcomplicates deployments.
Production Implementation: Resuming with CheckpointManager
from wpipe import Pipeline, step, CheckpointManager
# 1. Initialize pipeline with state persistence
pipeline = Pipeline(pipeline_name="resilient_etl")
# 2. Add checkpoint guard based on logical state expression
pipeline.add_checkpoint(
checkpoint_name="data_loaded",
expression="len(records) > 0"
)
@step(name="fetch_source")
def fetch_source(data):
# Simulating data ingestion
return {"records": [101, 102, 103], "status": "loaded"}
@step(name="heavy_compute")
def heavy_compute(data):
# Intensive CPU computation
processed = [r * 2 for r in data["records"]]
return {"processed": processed}
pipeline.set_steps([fetch_source, heavy_compute])
# 3. Automatic recovery check
chk = CheckpointManager("pipeline_state.db")
if chk.can_resume("resilient_etl"):
print("Detected prior interruption — Resuming from last verified checkpoint...")
result = pipeline.resume()
else:
result = pipeline.run({})
Why WPipe Checkpointing Outperforms
- SQLite WAL Mode Engine: Minimal disk I/O overhead; writes state changes in microseconds without locking concurrent reads.
- Smart Serialization: Gracefully filters non-serializable objects and cyclical memory graphs.
- Pure Python & Zero Bloat: No external server daemon required — embeds directly into any worker process or container.
Installation & Repository
pip install wpipe
- GitHub: https://github.com/wisrovi/wpipe
- PyPI: https://pypi.org/project/wpipe/
- Documentation: https://wpipe.readthedocs.io
Author: William Steve Rodríguez Villamizar (Wisrovi)
Top comments (0)