Skip to content

Reject nonpositive parallel worker counts - #818

Open
IlyaKhalafi wants to merge 1 commit into
qdrant:mainfrom
IlyaKhalafi:fix/positive-worker-count
Open

IlyaKhalafi wants to merge 1 commit into
qdrant:mainfrom
IlyaKhalafi:fix/positive-worker-count

Conversation

@IlyaKhalafi

Copy link
Copy Markdown

This PR fixes nonpositive worker counts waiting for a worker that was never started. With this, ParallelWorkerPool rejects them immediately with ValueError. This also applies to empty input. The public parallel=0 option still selects the CPU count.

Fixes #817.

12 focused tests, pre-commit and the CI mypy command passed. The existing early-close worker test was excluded because it also fails on upstream in this environment.

@IlyaKhalafi
IlyaKhalafi requested a review from joein as a code owner October 14, 2026 10:35
@coderabbitai

coderabbitai Bot commented Oct 14, 2026

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 89b3c47f-6e0e-45ae-949d-bd107905f4b7
📥 Commits

Reviewing files that changed from the base of the PR and between f48af32 and 0220a20.

📒 Files selected for processing: 2
  • fastembed/parallel_processor.py
  • tests/test_parallel_processor.py

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

📝 Walkthrough

ParallelWorkerPool.__init__ now raises ValueError when num_workers is zero or negative. Tests cover rejection of zero and negative values, and verify that worker counts of one and two preserve input order in ordered_map and leave pool.processes empty after iteration.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 0220a

Invalid worker counts now fail with ValueError before worker queues are allocated, while parallel=0 retains automatic CPU selection with a safe fallback. No material merge-blocking issue is established.

Pre-merge checks: Passed 3 · Failed 1 · Inconclusive 1

Failed Failed checks: 1 warning · 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Linked Issues check Inconclusive For #817, ParallelWorkerPool.__init__ raises ValueError for num_workers <= 0 before queue creation. The change also covers empty input because pool construction fails before iteration. Tests cov… Provide reviewable evidence from the public embedding path or an automated test that parallel=0 resolves to a positive worker count.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: rejecting nonpositive parallel worker counts.
Description check Passed The description accurately explains the ValueError behavior, the empty-input case, the public parallel=0 behavior, linked issue, and validation performed.
Out of Scope Changes check Passed The changes are limited to the #817 validation and focused tests for invalid and positive worker counts. The tests verify error handling, ordered results, and process cleanup. No unrelated change is s…
Full details: Linked Issues check

Explanation

For #817, ParallelWorkerPool.__init__ raises ValueError for num_workers &lt;= 0 before queue creation. The change also covers empty input because pool construction fails before iteration. Tests cover 0, -1, and -2. The available evidence does not establish that the public parallel=0 path still resolves to a positive CPU count.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Non-positive worker counts wait for results without starting workers

1 participant