Update checkpoint for a file. Args: file_path: Path to the data file. processed_idx: Index of last processed item (exclusive). total_items: Total number of items in the file.
(self, file_path: str, processed_idx: int, total_items: int)
| 111 | return False |
| 112 | |
| 113 | def update(self, file_path: str, processed_idx: int, total_items: int) -> None: |
| 114 | """Update checkpoint for a file. |
| 115 | |
| 116 | Args: |
| 117 | file_path: Path to the data file. |
| 118 | processed_idx: Index of last processed item (exclusive). |
| 119 | total_items: Total number of items in the file. |
| 120 | """ |
| 121 | completed = processed_idx >= total_items |
| 122 | |
| 123 | self.checkpoints[file_path] = { |
| 124 | "processed_idx": processed_idx, |
| 125 | "total_items": total_items, |
| 126 | "last_update": time.time(), |
| 127 | "completed": completed, |
| 128 | } |
| 129 | self._save() |
| 130 | |
| 131 | if self.logger and completed: |
| 132 | self.logger.info(f"File {file_path} processing completed") |
| 133 | |
| 134 | def mark_completed(self, file_path: str, total_items: int = 0) -> None: |
| 135 | """Mark a file as fully processed. |