Repository navigation
[Data] (Data fault tolerance) Rework lineage reconstruction + streaming executor integration tests to prevent flakiness - #68049
Conversation
Signed-off-by: Ayush Kumar <[email protected]>
Signed-off-by: Ayush Kumar <[email protected]>
There was a problem hiding this comment.
Code Review
This pull request refactors the lineage reconstruction tests by separating them into integration tests in test_lineage_reconstruction.py and unit tests in test_lineage_reconstruction_executor.py. The integration tests introduce several end-to-end test pipelines. However, some of these tests use helper functions that mutate the global DataContext without including the restore_data_context fixture, which can lead to state leakage and test flakiness.
…ing gen stub Signed-off-by: Ayush Kumar <[email protected]>
Signed-off-by: Ayush Kumar <[email protected]>
Kunchd
left a comment
There was a problem hiding this comment.
The change to make tests more deterministic makes sense. I left two clarification questions.
| task.mark_aborted(error) | ||
| task.mark_aborted(error) |
There was a problem hiding this comment.
Maybe a dumb question, why is mark_aborted invoked twice here?
There was a problem hiding this comment.
I think its testing even if you call abort twice, it does not repeated and the done callback only has one instance (next line verifies that only a single object exists in the array)
There was a problem hiding this comment.
That is right. I've added a comment to explain this along with a second assert to confirm that this comes from the first call to mark aborted
| ) | ||
|
|
||
|
|
||
| def test_flag_off_disables_data_lineage_reconstruction( |
There was a problem hiding this comment.
We're removing a lot of cases from before. Why don't we need them anymore?
There was a problem hiding this comment.
A lot of the cases have been removed because make assertions about private state, which can be brittle. For e.g. we were asserting the number of reconstructions based on the objects found ready in each poll of the streaming executor.
That being said I've removed the brittle assertions and added this test back as well as test_joined_plans_sharing_a_child_release_it_once because these were testing new logic
|
|
||
| task.mark_aborted(error) | ||
| task.mark_aborted(error) | ||
| assert done_calls == [{"error": error, "aborted_for_reconstruction": False}] |
There was a problem hiding this comment.
nit: maybe we can have the dict be returned from a std func or base constant which makes it easy for maintaining both the task done callback on L32 and other instances of comparing this object.
There was a problem hiding this comment.
Done, added a helper which creates this object
Signed-off-by: Ayush Kumar <[email protected]>
Signed-off-by: Ayush Kumar <[email protected]>
|
merge conflict @ayushk7102 |
Signed-off-by: Ayush Kumar <[email protected]> # Conflicts: # python/ray/data/tests/test_lineage_reconstruction.py
…ft-integration Brings in master's #68049 (via 6/n), which reworked the lineage reconstruction tests and moved the executor-side ones into tests/unit/test_lineage_reconstruction_executor.py. Re-applies 13/n's test changes on top: - test_shared_child_is_batched_until_it_is_submitted keeps its dropped/released assertions, on #68049's always-queued version. - The executor unit tests call the public fire_done_callbacks, and gain _route_lost_fetches with its two tests and the stricter LineageReconstructionError assertion. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: iamjustinhsu <[email protected]>
…ests into jhsu/generalize-lineage-tracker-for-intermediate-available-inputs Brings master's #68049 test rework up from 6/n. Re-applies this branch's test changes on top: - _lose takes reconstruction_plan_ids and gives its task a no-op cancel callback; stamp_seed_reconstruction_task is now stamp_reconstruction_task. - Adds test_failed_child_rerun_re_injects_a_seed_whose_rerun_is_still_streaming next to #68049's test_lost_reconstruction_task_is_re_traced_under_its_plan, which it extends to a seed re-run that is still streaming. - In the executor unit tests, _abortable_task takes cancel_callback, the mark-aborted test expects one cancel, register_task_failed returns a dict, and the LineageReconstructionError assertions match this branch. #68049's test_lost_reconstruction_task_is_re_traced_under_its_plan now reports the consumer re-run's loss through _lose: losing a task cancels it, and the real task's streaming generator is a mock. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: iamjustinhsu <[email protected]>
Brings the rest of the stack up to date, including master's #68049 test rework from 6/n. Conflicts resolve to this branch's side: - operator_sizer.py, test_operator_sizer.py and tick.py (deleted here): this branch replaced the _held_actors_by_op / _grow_to_held bookkeeping and the SizingTicker with op_status Held statuses, and already has the incoming warmup wait on ops awaiting their first input. - groupby_benchmark.py: this branch's newer version, whose _query_prometheus and benchmark_job_config helpers exist in benchmark.py. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: iamjustinhsu <[email protected]>
Description
This PR rewrites all of the integration tests for lineage reconstruction as well as some unit tests, to fix flakiness in the test suite.
Why
test_lineage_reconstructionwas flaky in CI. This is because several tests simulated a lost block with alose_outputfixture that monkeypatchedDataOpTask.on_data_readyto raiseObjectLostErroron the Nth time the executor polled a given task. The problem is that the number of polls it takes to drain a task is non-deterministic. It depends on whether metadata is fetched on a background thread or inline, and on how fast tasks are submitted and finish. the task drained before the Nth poll, so the loss never fired and an assertion based on the number of reconstructions failed.Integration test changes
Rather than relying on executor poll timing/task completion time, we now encode a failure into the data itself (i.e. a particular row will tell the UDF to mock a lost block). A
map_batchesUDF raisesObjectLostErrorwhen it sees a specific row, and the executor handles that exactly like a block lost with its node. The end-to-end tests then check that the loss actually happened, and every row comes back exactly once. They cover linear, fan-in, fan-out, multi-operator, actor pool and write pipelines, plus a block that's lost a second time while it's being reconstructed.Unit test changes
I reworked all of the old lineage reconstruction unit tests that are specific to the integration with the streaming executor. The purely unit tests that don't need a Ray cluster moved to
tests/unit/test_lineage_reconstruction_executor.py.No production code changes.
Related issues
Related to #66220 and #66990.
Additional information
I checked open PRs and nothing else rewrites these tests. #67366, #67885 and #68042 add tests to the same file, so whichever of us lands second will need to rebase.
Testing: I ran the unit tests 30 times and the integration tests 6 times (3 with the threaded metadata fetcher, 3 with the inline one). Everything passed every time.