Repository navigation
fix(task): queue one PDF task for PaddleOCR, SoMark and TCADP - #20136
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughTask queuing now identifies MinerU, PaddleOCR, SoMark, and TCADP by normalized layout-recognizer name. These parsers receive a single task spanning the file, with configured page ranges merged. Tests cover these parsers and confirm DeepDOC retains page-size-based splitting. ChangesWhole-file parser task queuing
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: Merge Risk: ⚪ Minimal · up to The change appears ready to merge after normal checks: the intended parsers queue one task, while DeepDOC retains split tasks. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. A rabbit checks the parser names, Comment |
|
Main removed The Go server does not have this defect. It queues one ingestion task per document, and a unique index on The file still exists on |
queue_tasks splits a PDF into 12-page tasks unless the layout recognizer is MinerU. PaddleOCR, SoMark and TCADP ignore from_page and to_page and send the whole PDF on every task, so a 120-page PDF made 10 full parses on a paid or quota service, 10 embedding runs, and a chunk_num about 10x too high. Resolve the layout recognizer with normalize_layout_recognizer and use the MinerU unsplit-task mode for all four parsers. TCADP is stored as the plain name "TCADP Parser", so the check now also reads plain names. Co-Authored-By: Claude Opus 5.5 <[email protected]>
3d97a25 to
13ff82f
Compare
|
Retargeted to |
|
LGTM |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 0.27.x #20136 +/- ##
==========================================
- Coverage 38.01% 37.97% -0.04%
==========================================
Files 54 54
Lines 15511 15527 +16
Branches 125 125
==========================================
Hits 5896 5896
- Misses 9587 9603 +16
Partials 28 28 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
queue_taskssplits a PDF into 12-page tasks. It skips the split only forone,knowledge_graph,resume,toc_extractionand MinerU. PaddleOCR, SoMark and TCADP are not in that list, but none of them reads the task's page range:by_paddleocrtakesfrom_page/to_pageand does not pass them toparse_pdfby_somark, same shapeby_tcadpcallsparse_pdfwith the defaultsfile_start_page=1,file_end_page=1000Nothing in
rag/app/naive.pytrims the output to the task's pages after the call. So a 120-page PDF queues 10 tasks, and every task parses and embeds the whole file:xxh64(content + doc_id), so the store keeps one copy.increment_chunk_numadds each task's chunk count, sochunk_numis about 10x too high.The comment on the MinerU check gives the same reason: a split task "would repeatedly upload the entire PDF". This PR uses that unsplit-task mode for PaddleOCR, SoMark and TCADP too.
queue_tasksnow passes the resolved layout recognizer throughnormalize_layout_recognizer, the same functionrag/app/naive.pyuses for dispatch. It then checks the lowercased name against{"mineru", "paddleocr", "somark", "tcadp parser"}, which are thePARSERSkeys innaive.py. The UI stores TCADP as the plain name"TCADP Parser", not as a tenant model id, so the check now reads plain names too. A MinerU recognizer stored as a plain name therefore also gets one task. The multi-range merge from the MinerU mode applies to all four parsers.This does not change what gets indexed. These three parsers already ignore the
pagessetting and index the whole file on every task. One task takes about as long as the slowest of the current parallel tasks, because each of those already runs the full parse.queue_taskson a 120-page PDF:0.27.x...@PaddleOCR...@SoMarkTCADP ParserDeepDOCThe new tests in
test_task_service_mineru_page_ranges.pycover the table above and a two-range case for PaddleOCR.0.27.xtest_task_service_mineru_page_ranges.py+test_task_service_queue_tasks.pytest/unit_test/api+test/unit_test/commonThe one failure on both is
test_time_utils.py::TestTimestampToDate::test_different_timezones_handled.ruff checkandruff format --checkpass on both changed files.Not in this PR:
FileStartPageNumberandFileEndPageNumberinstead. That would keep the split for TCADP, but it changes what gets indexed whenpagesis set.