Repository navigation
[Tune] Fix Repeater crash when search finishes - #65960
Conversation
Signed-off-by: Arnav Sharma <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request updates the Repeater searcher in Ray Tune to correctly handle the Searcher.FINISHED sentinel value when generating suggestions, preventing it from attempting to wrap a finished state in a trial group. Additionally, a comprehensive unit test test_repeater_searcher_finished has been added to verify this behavior and ensure that result aggregation for pending trials is preserved when suggestions are exhausted. There are no review comments to address, and the changes look solid.
There was a problem hiding this comment.
🟢 Approval recommended
The change is small, directly addresses the reported crash mode, and is backed by targeted regression tests covering the completion and aggregation edge cases.
Pull request overview
This PR fixes a crash in Tune’s Repeater wrapper when an underlying searcher signals completion via Searcher.FINISHED, ensuring Repeater.suggest() passes the sentinel through instead of asserting on a non-dict config. It also adds regression coverage to confirm correct behavior for temporary None suggestions, clean termination on FINISHED, and correct aggregation of pending repeated-trial results after the search finishes.
Changes:
- Treat
Searcher.FINISHEDthe same asNoneinRepeater.suggest()(return early, don’t create a_TrialGroup). - Add a regression test covering: transient
Nonesuggestions (no premature finish),FINISHED(clean finish), and post-finish result aggregation for pending repeats.
File summaries
| File | Description |
|---|---|
| python/ray/tune/search/repeater.py | Return early from suggest() when the wrapped searcher returns Searcher.FINISHED, preventing _TrialGroup construction on a non-dict. |
| python/ray/tune/tests/test_searcher_utils.py | Add regression test validating Repeater behavior for None vs FINISHED suggestions and verifying pending repeated-trial aggregation still completes after finish. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
This pull request has been automatically marked as stale because it has not had You can always ask for help on our discussion forum or Ray's public slack channel. If you'd like to keep this open, just leave any comment, and the stale label will be removed. |
pseudo-rnd-thoughts
left a comment
There was a problem hiding this comment.
Thanks for the PR, I checked the original issue and confirmed its still an issue and the fix resolves the issue
Fixes ray-project#43489. Handle `Searcher.FINISHED` in `Repeater.suggest()` so a finished search stops cleanly instead of raising an assertion. Adds regression coverage for completion, temporary pauses, and pending result aggregation. ### Tests - `RAY_TRAIN_V2_ENABLED=1 python -m pytest --import-mode=importlib -q python/ray/tune/tests/test_searcher_utils.py` — **12 passed**. - `pre-commit run --files python/ray/tune/search/repeater.py python/ray/tune/tests/test_searcher_utils.py` — **passed**. Both new regression cases and a real BayesOpt/Tuner reproduction fail before the fix and pass afterward. Tested locally on macOS with Python 3.12. Checked upstream and related/open PRs; no equivalent fix found. AI assistance was used. Signed-off-by: Arnav Sharma <[email protected]>
Fixes ray-project#43489. Handle `Searcher.FINISHED` in `Repeater.suggest()` so a finished search stops cleanly instead of raising an assertion. Adds regression coverage for completion, temporary pauses, and pending result aggregation. ### Tests - `RAY_TRAIN_V2_ENABLED=1 python -m pytest --import-mode=importlib -q python/ray/tune/tests/test_searcher_utils.py` — **12 passed**. - `pre-commit run --files python/ray/tune/search/repeater.py python/ray/tune/tests/test_searcher_utils.py` — **passed**. Both new regression cases and a real BayesOpt/Tuner reproduction fail before the fix and pass afterward. Tested locally on macOS with Python 3.12. Checked upstream and related/open PRs; no equivalent fix found. AI assistance was used. Signed-off-by: Arnav Sharma <[email protected]>
Fixes #43489.
Handle
Searcher.FINISHEDinRepeater.suggest()so a finished search stops cleanly instead of raising an assertion. Adds regression coverage for completion, temporary pauses, and pending result aggregation.Tests
RAY_TRAIN_V2_ENABLED=1 python -m pytest --import-mode=importlib -q python/ray/tune/tests/test_searcher_utils.py— 12 passed.pre-commit run --files python/ray/tune/search/repeater.py python/ray/tune/tests/test_searcher_utils.py— passed.Both new regression cases and a real BayesOpt/Tuner reproduction fail before the fix and pass afterward. Tested locally on macOS with Python 3.12.
Checked upstream and related/open PRs; no equivalent fix found.
AI assistance was used.