-
Notifications
You must be signed in to change notification settings - Fork 7k
[Data][Flaky] fix test_limit_pushdown_conservative fails due to non-deterministic task ordering #58655
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
[Data][Flaky] fix test_limit_pushdown_conservative fails due to non-deterministic task ordering #58655
Conversation
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 enhances the limit pushdown tests by introducing an option to disable ordering checks, which helps in stabilizing flaky tests where the output order is not guaranteed. The main change is in the _check_valid_plan_and_result helper function, which now conditionally checks for order. When order is not checked, it compares the results as sorted lists. I've suggested a minor improvement to use collections.Counter for a more idiomatic and potentially more performant unordered comparison. The application of check_ordering=False to the relevant test cases seems correct and addresses the flakiness issue.
python/ray/data/tests/test_execution_optimizer_limit_pushdown.py
Outdated
Show resolved
Hide resolved
python/ray/data/tests/test_execution_optimizer_limit_pushdown.py
Outdated
Show resolved
Hide resolved
400Ping
left a comment
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.
LGTM
d4cf9d8 to
033adb0
Compare
|
thanks for the review @400Ping ! |
python/ray/data/tests/test_execution_optimizer_limit_pushdown.py
Outdated
Show resolved
Hide resolved
c73cd4c to
838b73f
Compare
0c388c8 to
89432eb
Compare
| if check_ordering: | ||
| assert actual_result == expected_result |
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.
Any reason we can't always use rows_same (i.e., always use check_ordering=False)? Are there any tests in this file where the ordering is guaranteed by Ray Data's interface?
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.
I think there's still some need to check ordering, for example test 6 the ordering is guaranteed.
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.
Ah, I see. I guess there are a few tests that call sort
In a follow-up PR, would you mind updating all of the other tests in this module where the ordering isn't guaranteed? Seems like most of the tests assume ordering when it's not guaranteed
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.
Separately, I think it'd be good to break up the different test cases into separate test functions for the reasons described here: https://learn.microsoft.com/en-us/dotnet/core/testing/unit-testing-best-practices#avoid-multiple-act-tasks
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.
Cool, I'll open a refactor pr soon!
Added check_ordering parameter to _check_valid_plan_and_result function to allow for ordering checks to be optional. Updated multiple test cases to utilize the new parameter. Signed-off-by: Ryan Huang <[email protected]> Update test_execution_optimizer_limit_pushdown.py Signed-off-by: Ryan Huang <[email protected]> Update python/ray/data/tests/test_execution_optimizer_limit_pushdown.py Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Signed-off-by: Ryan Huang <[email protected]> remove unnessary relaxation Signed-off-by: Ryan Huang <[email protected]> remove unnessary relaxation Updated the test to not check ordering in the execution optimizer limit pushdown. Signed-off-by: Ryan Huang <[email protected]> Refactor to_hashable function for clarity Signed-off-by: Ryan Huang <[email protected]> Fix formatting in test_execution_optimizer_limit_pushdown Signed-off-by: Ryan Huang <[email protected]> please linter Signed-off-by: ryankert01 <[email protected]>
Co-authored-by: You-Cheng Lin <[email protected]> Signed-off-by: Ryan Huang <[email protected]> Signed-off-by: ryankert01 <[email protected]>
Removed comment about comparing as multisets when ordering doesn't matter. Signed-off-by: Ryan Huang <[email protected]> Signed-off-by: ryankert01 <[email protected]>
Signed-off-by: ryankert01 <[email protected]>
89432eb to
1a6a21f
Compare
owenowenisme
left a comment
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.
cc @bveeramani
…eterministic task ordering (ray-project#58655) ## Description I add a param that can determin whether we should check the order or not, release restriction for flaky tests. ## Related issues Closes ray-project#58561 ## Additional information I ran test 20 times using a simple script that rans `python -m pytest python/ray/data/tests/test_execution_optimizer_limit_pushdown.py::test_limit_pushdown_conservative`: - master: `Passed: 18, Failed: 2` - feature/flaky-test_limit_pushdown_conservative: `Passed: 20, Failed: 0` --------- Signed-off-by: ryankert01 <[email protected]> Signed-off-by: Ryan Huang <[email protected]> Co-authored-by: You-Cheng Lin <[email protected]> Signed-off-by: Aydin Abiar <[email protected]>
…ix ordering assumption (#58746) ## Description **Split multi-case test function** - `test_limit_pushdown_conservative` → 10 separate tests (basic fusion, limit fusion reversed, multiple limit fusion, maprows, mapbatches, filter, project, sort, complex interweaved operations, and between two map operators) **Fixed ordering assumptions** - Added `check_ordering=False` to union tests (blocks may interleave) - Added `check_ordering=False` to project test with `override_num_blocks` (parallel execution) ## Related issues Related to #58655 ## Additional information --------- Signed-off-by: ryankert01 <[email protected]>
…eterministic task ordering (ray-project#58655) ## Description I add a param that can determin whether we should check the order or not, release restriction for flaky tests. ## Related issues Closes ray-project#58561 ## Additional information I ran test 20 times using a simple script that rans `python -m pytest python/ray/data/tests/test_execution_optimizer_limit_pushdown.py::test_limit_pushdown_conservative`: - master: `Passed: 18, Failed: 2` - feature/flaky-test_limit_pushdown_conservative: `Passed: 20, Failed: 0` --------- Signed-off-by: ryankert01 <[email protected]> Signed-off-by: Ryan Huang <[email protected]> Co-authored-by: You-Cheng Lin <[email protected]> Signed-off-by: YK <[email protected]>
…ix ordering assumption (ray-project#58746) ## Description **Split multi-case test function** - `test_limit_pushdown_conservative` → 10 separate tests (basic fusion, limit fusion reversed, multiple limit fusion, maprows, mapbatches, filter, project, sort, complex interweaved operations, and between two map operators) **Fixed ordering assumptions** - Added `check_ordering=False` to union tests (blocks may interleave) - Added `check_ordering=False` to project test with `override_num_blocks` (parallel execution) ## Related issues Related to ray-project#58655 ## Additional information --------- Signed-off-by: ryankert01 <[email protected]> Signed-off-by: YK <[email protected]>
…eterministic task ordering (ray-project#58655) ## Description I add a param that can determin whether we should check the order or not, release restriction for flaky tests. ## Related issues Closes ray-project#58561 ## Additional information I ran test 20 times using a simple script that rans `python -m pytest python/ray/data/tests/test_execution_optimizer_limit_pushdown.py::test_limit_pushdown_conservative`: - master: `Passed: 18, Failed: 2` - feature/flaky-test_limit_pushdown_conservative: `Passed: 20, Failed: 0` --------- Signed-off-by: ryankert01 <[email protected]> Signed-off-by: Ryan Huang <[email protected]> Co-authored-by: You-Cheng Lin <[email protected]>
…ix ordering assumption (ray-project#58746) ## Description **Split multi-case test function** - `test_limit_pushdown_conservative` → 10 separate tests (basic fusion, limit fusion reversed, multiple limit fusion, maprows, mapbatches, filter, project, sort, complex interweaved operations, and between two map operators) **Fixed ordering assumptions** - Added `check_ordering=False` to union tests (blocks may interleave) - Added `check_ordering=False` to project test with `override_num_blocks` (parallel execution) ## Related issues Related to ray-project#58655 ## Additional information --------- Signed-off-by: ryankert01 <[email protected]>
Description
I add a param that can determin whether we should check the order or not, release restriction for flaky tests.
Related issues
Closes #58561
Additional information
I ran test 20 times using a simple script that rans
python -m pytest python/ray/data/tests/test_execution_optimizer_limit_pushdown.py::test_limit_pushdown_conservative:Passed: 18, Failed: 2Passed: 20, Failed: 0