-
Notifications
You must be signed in to change notification settings - Fork 6.8k
[Data] Make test_hanging_detector_detects_issues
more robust
#57567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Balaji Veeramani <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request significantly improves the robustness of test_hanging_detector_detects_issues
by replacing a complex, custom log-capturing mechanism with the standard pytest
caplog
fixture. This change simplifies the test, makes it easier to understand, and less prone to errors. The addition of the restore_data_context
fixture is also a great improvement for test isolation.
I have one suggestion to make the test assertion even more specific and robust.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Signed-off-by: Balaji Veeramani <[email protected]>
This reverts commit c338363. Signed-off-by: Balaji Veeramani <[email protected]>
…roject#57567) <!-- Thank you for your contribution! Please review https://github.com/ray-project/ray/blob/master/CONTRIBUTING.rst before opening a pull request. --> <!-- Please add a reviewer to the assignee section when you create a PR. If you don't have the access to it, we will shortly find a reviewer and assign them to your PR. --> ## Why are these changes needed? <!-- Please give a short summary of the change and the problem this solves. --> `test_hanging_detector_detects_issues` checks that Ray Data emits a log if one task takes a lot longer than the others. The issue is that the test doesn't capture the log output correctly, and so the test fails even though Ray data correctly emits the log. To make this test more robust, this PR uses pytest's `caplog` fixture to capture the logs rather than a bespoke custom handler. ``` [2025-10-08T09:00:41Z] > assert hanging_detected, log_output | [2025-10-08T09:00:41Z] E AssertionError: | [2025-10-08T09:00:41Z] E assert False | [2025-10-08T09:00:41Z] | [2025-10-08T09:00:41Z] python/ray/data/tests/test_issue_detection_manager.py:153: AssertionError | ``` ## Related issue number <!-- For example: "Closes ray-project#1234" --> ## Checks - [ ] I've signed off every commit(by using the -s flag, i.e., `git commit -s`) in this PR. - [ ] I've run pre-commit jobs to lint the changes in this PR. ([pre-commit setup](https://docs.ray.io/en/latest/ray-contribute/getting-involved.html#lint-and-formatting)) - [ ] I've included any doc changes needed for https://docs.ray.io/en/master/. - [ ] I've added any new APIs to the API Reference. For example, if I added a method in Tune, I've added it in `doc/source/tune/api/` under the corresponding `.rst` file. - [ ] I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/ - Testing Strategy - [ ] Unit tests - [ ] Release tests - [ ] This PR is not tested :( --------- Signed-off-by: Balaji Veeramani <[email protected]> Signed-off-by: Josh Kodi <[email protected]>
Why are these changes needed?
test_hanging_detector_detects_issues
checks that Ray Data emits a log if one task takes a lot longer than the others. The issue is that the test doesn't capture the log output correctly, and so the test fails even though Ray data correctly emits the log.To make this test more robust, this PR uses pytest's
caplog
fixture to capture the logs rather than a bespoke custom handler.Related issue number
Checks
git commit -s
) in this PR.method in Tune, I've added it in
doc/source/tune/api/
under thecorresponding
.rst
file.