Skip to content

[Data] Cap number of kills for lineage reconstruction release test - #68378

Merged
goutamvenkat-anyscale merged 1 commit into
ray-project:masterfrom
ayushk7102:cap_lr_release_test_kills
Nov 24, 2026
Merged

goutamvenkat-anyscale merged 1 commit into
ray-project:masterfrom
ayushk7102:cap_lr_release_test_kills

Conversation

@ayushk7102

Copy link
Copy Markdown
Contributor

Description

image_embedding_from_uris_fake_gpu_lineage_reconstruction_chaos (added in #67519) runs chaos with no limit on kills. Chaos continues for the whole run, re-executed work keeps adding to the runtime, and the run can hit the timeout.

This PR passes --chaos-max-kills through a max_kills matrix of 8, 16 and 30. 16 is the default to run. Each round kills 2 raylets (--chaos-kill-batch-size 2), so the caps are even and the limit lands exactly on the cap.

The test is renamed to image_embedding_from_uris_fake_gpu_lineage_reconstruction_chaos_kills_{8,16,30}. It's still frequency: manual.

Related issue number

Follow-up to #67519. No open PR covers this.

Testing

Parsed and schema-validated release/release_data_tests.yaml with ray_release.config.parse_test_definition and validate_release_test_collection. The matrix expands into the 3 tests, and each one passes the matching --chaos-max-kills.

AI assistance (Claude Code) was used for this change.

🤖 Generated with Claude Code

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

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 updates the manual test image_embedding_from_uris_fake_gpu_lineage_reconstruction_chaos in release/release_data_tests.yaml to run as a matrix test over different max_kills values (8, 16, and 30). It parameterizes the test name and adds the --chaos-max-kills argument to the test execution command. There are no review comments, and I have no additional feedback to provide.

@goutamvenkat-anyscale goutamvenkat-anyscale added the go add ONLY when ready to merge, run all tests label Nov 24, 2026
@goutamvenkat-anyscale
goutamvenkat-anyscale enabled auto-merge (squash) November 24, 2026 18:20
@goutamvenkat-anyscale
goutamvenkat-anyscale merged commit 6550bdc into ray-project:master Nov 24, 2026
7 checks passed
sampan-s-nayak added a commit that referenced this pull request Nov 25, 2026
…inal task index (#68400)

## Summary

A lineage reconstruction task now runs with the `TaskContext.task_idx`
of the task it re-runs. Before, it got a fresh index, so a re-run
`Write` added a second file instead of replacing the first, and seeded
operations drew different values.

## Before

`TaskContext.task_idx` came from the operator's submission counter,
`_next_data_task_idx`, which goes up on every submission, including
reconstruction tasks. Several things are keyed on that index, and assume
a re-run of the same task sees the same value:

- **File writes.** `FilenameProvider` names a file
`{write_uuid}_{task_index}`, and its contract says names "must be unique
and deterministic for a given write UUID and task index". Parquet writes
with `existing_data_behavior="overwrite_or_ignore"`. A Ray Core retry
resends the same `TaskContext`, so it overwrites its own file. A
reconstruction task got a new index, so it wrote a new file. If the
failed attempt's file had already landed (for example, the node died
after the upload but before the driver heard back), both files stayed,
and the output had duplicated rows. Ray Data's own `Data sink ...
finished. N rows` count stays correct, because it only counts the
attempt it saw finish.
- **Seeded and indexed values.** `random_sample(seed=...)`,
`streaming_train_test_split(seed=...)`, the `random(seed=...)`
expression and `monotonically_increasing_id()` all derive from the
index, so a re-run produced different rows, values or IDs.
Reconstruction also assumes a re-run reproduces its output block for
block, since it skips blocks that were already delivered downstream.

We hit the write case in a chaos release test
(`image_embedding_from_uris_fake_gpu_lineage_reconstruction_chaos`,
actor-only backend): the output check found 1,326 duplicated rows (41
images written twice), while the sink reported exactly the expected
2,484,000 rows.

## After

`MapOperator._context_task_idx(inputs)` picks the index for the task's
`TaskContext`. For a bundle that carries a `reconstruction_stamp`, it is
the original index, read back from the stamp's lineage task ID
(`{op_id}:{task_index}`). Otherwise it is the next counter value, as
before. All three ways of submitting a map task use it: the task pool,
the actor pool and the experimental actor-only pool. The operator's own
bookkeeping (the in-flight task map, `preserve_order` output keys) still
uses the fresh counter, so a re-run never shares a key with the attempt
it replaces.

A re-run `Write` now overwrites the failed attempt's file, and seeded
operations reproduce their original output.

```mermaid
flowchart TD
    subgraph Before
        subgraph BS[Subsystem: execution]
            subgraph BC[Component: MapOperator task submission]
                B1[reconstruction bundle] --> B2["TaskContext.task_idx = _next_data_task_idx (new)"]
                B2 --> B3["Write: new file {uuid}_{new}"]
            end
        end
    end
    subgraph After
        subgraph AS[Subsystem: execution]
            subgraph AC[Component: MapOperator task submission]
                A1[reconstruction bundle] --> A2["TaskContext.task_idx = original index from reconstruction_stamp"]
                A2 --> A3["Write: overwrites {uuid}_{original}"]
            end
        end
    end
    classDef changed fill:#fff9c4,stroke:#f9a825,color:#000
    class A2,A3 changed
```

## Subsystems

Execution (map operator task submission). The three operator edits pass
the input bundle through so the helper can read its stamp.

## Not a duplicate

I searched open PRs for `task_idx`, "lineage reconstruction" with
"write" or "duplicate", "idempotent write" and "reconstruction task
index". The open Data fault-tolerance PRs (#68094, #68337, #68378) don't
change the task index.

## Testing

- `pytest
python/ray/data/tests/unit/test_lineage_reconstruction_executor.py`: 6
passed, including the new
`test_reconstruction_task_context_reuses_the_original_task_index`.
- `pre-commit` on the changed files: passes. `pyrefly-data` was run
separately with the hidden-directory exclusion turned off, because the
branch lives in a worktree under a dot-directory. It reports no errors
on changed lines.
- **Not run yet:** the two new end-to-end tests in
`test_lineage_reconstruction.py`
(`test_re_run_write_overwrites_the_file_of_the_failed_attempt` and
`test_re_run_draws_the_same_seeded_random_sample`). My local Ray build
doesn't match this branch, so workers fail at startup for every test in
that file, including existing ones. I'm building a matching one. I'll
run both tests with and without the fix, and keep this PR in draft until
they pass.

AI assistance (Claude Code) was used to investigate and write this
change. I've reviewed it.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Signed-off-by: sampan <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data Ray Data-related issues go add ONLY when ready to merge, run all tests release-test release test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants