Process a batch of knowledge points (serial within a batch)
(batch_data, cfg: RunConfig)
| 739 | |
| 740 | |
| 741 | def process_batch(batch_data, cfg: RunConfig): |
| 742 | """Process a batch of knowledge points (serial within a batch)""" |
| 743 | batch_idx, kp_batch, folder_path = batch_data |
| 744 | results = [] |
| 745 | print(f"Batch {batch_idx + 1} starts processing {len(kp_batch)} knowledge points") |
| 746 | |
| 747 | for local_idx, (idx, kp) in enumerate(kp_batch): |
| 748 | try: |
| 749 | if local_idx > 0: |
| 750 | delay = random.uniform(3, 6) |
| 751 | print(f"⏳ Batch {batch_idx + 1} waits {delay:.1f}s before processing {kp}...") |
| 752 | time.sleep(delay) |
| 753 | results.append(process_knowledge_point(idx, kp, folder_path, cfg)) |
| 754 | except Exception as e: |
| 755 | print(f"❌ Batch {batch_idx + 1} processing {kp} failed: {e}") |
| 756 | results.append((kp, None, 0, 0)) |
| 757 | return batch_idx, results |
| 758 | |
| 759 | |
| 760 | def run_Code2Video( |
nothing calls this directly
no test coverage detected