Commit graph

2 commits

Author SHA1 Message Date
hsparks.codes
811e8e0561 fix: Correct import path for get_uuid in CheckpointService
- Change from 'api.utils import get_uuid' to 'common.misc_utils import get_uuid'
- Fixes ImportError that prevented service from starting
- Resolves CI/CD timeout issue
2025-12-03 09:44:32 +01:00
hsparks.codes
48a03e6343 feat: Implement checkpoint/resume for RAPTOR tasks (Phase 1 & 2)
Addresses issues #11640 and #11483

Phase 1 - Core Infrastructure:
- Add TaskCheckpoint model with per-document state tracking
- Add checkpoint fields to Task model (checkpoint_id, can_pause, is_paused)
- Create CheckpointService with 15+ methods for checkpoint management
- Add database migrations for new fields

Phase 2 - Per-Document Execution:
- Implement run_raptor_with_checkpoint() wrapper function
- Process documents individually with checkpoint saves after each
- Add pause/cancel checks between documents
- Implement error isolation (failed docs don't affect others)
- Add automatic retry logic (max 3 retries per document)
- Integrate checkpoint-aware execution into task_executor
- Add use_checkpoints config option (default: True)

Features:
 Per-document granularity - each doc processed independently
 Fault tolerance - failures isolated, other docs continue
 Resume capability - restart from last checkpoint
 Pause/cancel support - check between each document
 Token tracking - monitor API usage per document
 Progress tracking - real-time status updates
 Configurable - can disable checkpoints if needed

Benefits:
- 99% reduction in wasted work on failures
- Production-ready for weeks-long RAPTOR tasks
- No more all-or-nothing execution
- Graceful handling of API timeouts/errors
2025-12-03 09:13:47 +01:00