MCPcopy Index your code
hub / github.com/showlab/Code2Video / process_batch

Function process_batch

src/agent.py:741–757  ·  view source on GitHub ↗

Process a batch of knowledge points (serial within a batch)

(batch_data, cfg: RunConfig)

Source from the content-addressed store, hash-verified

739
740
741def 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
760def run_Code2Video(

Callers

nothing calls this directly

Calls 1

process_knowledge_pointFunction · 0.85

Tested by

no test coverage detected