fix(indexer): keep pool actor alive for queued batches - #511
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough
ChangesIndexerPool Concurrency and Actor Lifecycle
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Collapse the duplicated max_concurrency assignment into a single expression. The bare cfg.ray.max_tasks_per_worker dropped the lower bound, which Ray rejects (max_concurrency must be >= 1) when the config is set to 0 or negative. The Pydantic model already guarantees an int, so the int()/getattr() guards were redundant; keep only the max(1, ...) floor.
Ahmath-Gadji
left a comment
There was a problem hiding this comment.
This solves the issue we had with batch indexing.
Context
Large indexing benchmarks can submit more work than the indexer can process immediately. In that case, queued tasks must remain attached to a live worker actor until their turn starts.
Problem
The indexer pool actor could be cleaned up by Ray while queued work still existed. Those tasks stayed visible as
QUEUED, but nothing was left to consume them. A full dataset run could then stop after the first window of files.Concurrent startup also let multiple tasks initialize the catalog store at the same time, which put unnecessary pressure on Postgres.
Expected behavior
The indexer pool remains alive for queued batches, respects the configured worker concurrency, and initializes its catalog connection once under concurrent load.
Validation
uv run pytest tests/unit/services/workers/test_indexer_pool.py -quv run pytest tests/unit/services/workers -quv run ruff format --check openrag/services/workers/indexer_pool.py tests/unit/services/workers/test_indexer_pool.pyuv run ruff check openrag/services/workers/indexer_pool.py tests/unit/services/workers/test_indexer_pool.pySummary by CodeRabbit