Skip to content

[Data] [4/4] Route generated-ID checkpointing in the planner, validate Parquet-only, add docs - #65888

Closed
abhishekverma-ray wants to merge 5 commits into
ray-project:masterfrom
abhishekverma-ray:rg-chkpt-4-planner-routing-docs
Closed

abhishekverma-ray wants to merge 5 commits into
ray-project:masterfrom
abhishekverma-ray:rg-chkpt-4-planner-routing-docs

Conversation

@abhishekverma-ray

Copy link
Copy Markdown
Contributor

Stack: PR 4 of 4 — stacked on #65887 (list/read-time skip mechanics). Review scope: the last two commits ("Route generated-ID checkpointing through ListFiles..." and "Document generated_id_column checkpointing"). This is the switch-on PR: with it merged, CheckpointConfig(generated_id_column=...) is fully functional end to end.

Why are these changes needed?

Activates the machinery from PRs 1–3 and closes the loop with end-to-end tests and user docs.

Planner routing (Planner.plan branches on CheckpointConfig.has_generated_id_column):

  • Generated-ID path registers only {ListFiles: plan_list_files_op_with_checkpoint_filter, Write: plan_write_op_with_checkpoint_writer} — the compact checkpoint block (loaded by LoadCheckpointCallback at execution start) is injected into listing tasks, and skipping happens at the source. No actor-pool filter is wrapped around Read/ReadFiles.
  • The id_column path keeps today's {Read, ReadFiles, Write} actor-pool wiring untouched (regression-covered).
  • The shared write 2PC needs no change: the generated column name is aliased onto id_column (PR 1).

Plan-time validation: for generated-ID configs, every source must be a datasource_v2 ReadFiles backed by a ParquetScanner. CSV/JSON sources and the V1 Read path raise InvalidCheckpointingConfig with an actionable message (use id_column instead). The validation sits behind the existing Write/StreamingSplit checkpointability gate, so schema() / count() plans never trip it. Join/agg DAGs that still start at ReadFiles and end at Write remain checkpointable; no promises are made about join/agg state (documented).

Docs: a short user-facing section in doc/source/data/execution-configurations.rst: how to enable generated row IDs, what gets skipped on resume, and the constraints (Parquet-only on the V2 path, 1-in-1-out pipelines with at-least-once semantics, identical pipeline across runs, ID column present in written output).

Related issue number

N/A. Not a duplicate: searched open PRs/issues in ray-project/ray for generated_id_column, "row group checkpoint" — no overlapping work.

Checks

  • I've signed off every commit (DCO).
  • I've run pre-commit hooks on all touched files — clean (including vale on the rst).
  • AI assistance (Claude Code) was used for the development of this PR. I, Abhishek Verma, am the human submitter signing off on it: I have reviewed every changed line, run the tests below locally, and can defend the change end-to-end.
  • Testing (new end-to-end tests in python/ray/data/tests/test_checkpoint.py):
    • test_generated_id_recovery_no_missing_rows — fail mid-run via an injected actor failure, rerun, verify at-least-once output (no missing rows) and checkpoint deletion on success.
    • test_generated_id_resume_skips_committed_work — pre-seeded committed checkpoint: fully-committed file omitted at list time, partially committed row group row-filtered, never-seen file read in full; output is exactly the uncommitted rows.
    • test_generated_id_restore_after_full_success_is_noop — with the checkpoint kept, a rerun lists nothing and writes zero rows.
    • test_generated_id_non_parquet_source_raises, test_generated_id_v1_read_path_raises — plan-time rejections.
    • All 21 generated-ID tests in the file pass; full test_checkpoint.py regression: 97/98 locally (the one failure is test_skip_checkpoint_flag[s3], a pre-existing local moto-server slowness that also fails on clean master).

…heckpoint load

Ports the generated-ID checkpoint load path from RayTurbo:

- generated_id.py gains the compact checkpoint table schema
  (checkpointed_file, checkpointed_file_fragments struct) and its
  consumers: parse_checkpointed_fragment_info / exclude_checkpointed_rows
  (read-time row filtering) and index/lookup helpers (list-time file
  skipping). Semantics: never-seen file has no row (null struct); a fully
  committed row group stores an empty mask list; a partial row group
  stores a dense boolean mask. Struct fields are always resolved by name
  because Parquet round-trips don't preserve struct field order.
- CheckpointManager.load_checkpoint is refactored around a shared
  _load_checkpoint_block (clean pending 2PC leftovers first, read
  committed IDs, preprocess, repartition to one block).
  GeneratedIdColumnCheckpointManager overrides the preprocess hook to
  compact raw struct IDs (hash-shuffle groupby file -> one row per file,
  sorted by path) and exposes load_checkpoint_as_block, since the
  numpy-based actor-pool filter can't consume struct IDs.
- LoadCheckpointCallback loads the compact block before execution for
  generated-ID configs and exposes load_checkpoint() for the upcoming
  ListFiles kwarg injection; delete-on-success is unchanged for both
  paths and failures still leave pending files as the recovery record.

Signed-off-by: Abhishek Verma <[email protected]>
…eckpointing

Threads the compact generated-ID checkpoint block through the V2 listing
stack:

- FileManifest gains an optional __file_fragments_checkpoint column (the
  per-file compact checkpoint struct; null = file never checkpointed),
  kept as an Arrow column so struct scalars survive. concat/shuffle are
  whole-block operations and preserve it for free.
- Both indexers accept checkpoint_ids: fully-checkpointed files are
  dropped before chunking (and, on the footer path, before footer reads,
  so their footers are never fetched on resume); surviving rows are
  stamped with their file's checkpoint struct.
- The partitioners (RoundRobinPartitioner, OnlineBinPacker) carry the
  column through manifest reconstruction so bin-packing can't drop it.
- ListFiles tasks read the block from ctx.kwargs;
  plan_list_files_op_with_checkpoint_filter attaches it lazily via
  MapOperator.add_map_task_kwargs_fn since the block is only loaded by
  LoadCheckpointCallback at execution start. (Planner routing to this
  plan fn lands in the follow-up commit.)

Signed-off-by: Abhishek Verma <[email protected]>
With generated-ID checkpointing, _get_fragments_to_read resolves each
row-group sub-fragment against the manifest's compact checkpoint struct:
fully-checkpointed row groups are dropped before any scan, and partially
checkpointed ones carry their CheckpointedFragmentInfo in a widened
(fragment, offset, info) tuple consumed by the _read_fragments_sequential
override. Committed rows are excluded AFTER the ID column is attached
(offsets counted on pre-filter batch sizes), so row_id assignment is
identical whether or not a resume is filtering — the invariant that makes
checkpoints written by one run addressable by the next.

Signed-off-by: Abhishek Verma <[email protected]>
…e Parquet-only

The planner now branches on CheckpointConfig.has_generated_id_column:

- generated-ID path registers only {ListFiles, Write} plan fns — the
  compact checkpoint block is injected into listing tasks (skipping
  happens at the source) and the shared write 2PC keys off the aliased
  id_column. No actor-pool filter is wrapped around Read/ReadFiles.
- id_column path keeps today's {Read, ReadFiles, Write} actor-pool wiring
  untouched.
- Plans that pass the checkpointability gate are additionally validated
  for the generated-ID path: every source must be a datasource_v2
  ReadFiles backed by a ParquetScanner; CSV/JSON sources and the V1 Read
  path raise InvalidCheckpointingConfig at plan time. schema()/count()
  plans never trip the validation because it runs behind the existing
  Write/StreamingSplit gate.

End-to-end tests cover mid-run failure recovery with no missing rows and
checkpoint deletion on success, resume semantics (fully-committed file
omitted at list time, partial row group row-filtered, never-seen file
read in full), no-op rerun after full success with a kept checkpoint, and
both rejection paths.

Signed-off-by: Abhishek Verma <[email protected]>
Adds a short user-facing note to the job-level checkpointing section:
how to enable auto-generated row IDs, what gets skipped on resume, and
the constraints (Parquet-only on the V2 datasource path, 1-in-1-out
pipelines with at-least-once semantics, identical pipeline across runs,
ID column present in written output).

Signed-off-by: Abhishek Verma <[email protected]>
@abhishekverma-ray
abhishekverma-ray force-pushed the rg-chkpt-4-planner-routing-docs branch from fbb0cb9 to 5089c26 Compare September 11, 2026 17:08
goutamvenkat-anyscale pushed a commit that referenced this pull request Sep 19, 2026
…arquet datasources (#66066)

## Description

Second PR of the DSv2 Reorg series (`[0/6]` … `[6/6]`), stacked on
#66244
(`[0/6]`); the diff shows both until that one merges.

`_read_datasource_v2` in `read_api.py` reads four attributes and calls
one
method that `DataSourceV2` never declared. Parquet defines them all, so
it
worked; any other datasource that implemented only the abstract methods
failed
with `AttributeError` inside the read code. After this PR, implementing
the
abstract members of `DataSourceV2` is enough for a new datasource to
work end
to end, and a missing one is reported at construction. No behavior
change for
Parquet.

```mermaid
flowchart LR
  R[read_api._read_datasource_v2] -->|reads paths, filesystem, file_extensions, shuffle; calls _get_file_indexer| D[DataSourceV2 base class]
  D -->|abstract: paths, filesystem, _get_file_indexer| S[new datasource subclass]
  D -->|default None: file_extensions, shuffle| S
```

### Changes

1. Declare everything the read code uses on `DataSourceV2`: `paths`,
`filesystem`, `_get_file_indexer` abstract; `file_extensions`, `shuffle`
   default `None`.
2. `filesystem` may be `None`, for sources that read through their own
   library (PyIceberg, Lance, hudi-rs).
3. `FileScanner.prune_manifest` → `Scanner.prune_input_split`, so
partition
   pruning runs for every scanner, not only `FileScanner` subclasses.
4. `FileIndexer` docstring updated for the per-file listing contract
left
   after #66244.

## Additional information

Not a duplicate: no open PR changes the `DataSourceV2` base class.
#65887 and
#65888 also touch `file_indexer.py` / `listing_utils.py`, so expect
small merge
conflicts there.

Tests run locally from this branch (macOS, `~/ray/.venv`), from
`python/ray/data`:

```
pytest -q tests/unit/datasource_v2                     # 119 passed
pytest -q tests/datasource/test_read_parquet_v2.py     # 37 passed
pytest -q tests/datasource/test_parquet.py             # 246 passed, 13 skipped, 34 errors
```

The 34 errors are moto `s3_fs` fixture setup errors (`moto_server` not
on
PATH), identical on master. `ruff`, `black` and `pydoclint` at the
pre-commit
pins are clean; `pyrefly` reports the same pre-existing errors as the
base
commit.

Written with Claude Code; I reviewed every changed line and ran the
tests above.

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

---------

Signed-off-by: Aarrya <[email protected]>
Co-authored-by: Claude Fable 5.1 <[email protected]>
@dstrodtman

Copy link
Copy Markdown
Contributor

Hi @abhishekverma-ray, heads-up: master converted a doc page this PR edits from reStructuredText to MyST Markdown, so that edit needs to move to the .md file when you rebase:

If you'd like help translating your edits to Markdown, DM me (Douglas Strodtman) on the Ray Slack and I'll help. If you'd rather handle it yourself, the repo has a Claude Code skill for this conversion at doc/.claude/skills/rst-to-myst/. Most small edits don't need it, though: any coding agent can translate them without the skill loaded.

@abhishekverma-ray

Copy link
Copy Markdown
Contributor Author

Superseded by the redo on top of the DSv2 reorg: #66732, #66733, #66734, #66735, #66736.

nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
…arquet datasources (ray-project#66066)

## Description

Second PR of the DSv2 Reorg series (`[0/6]` … `[6/6]`), stacked on
ray-project#66244
(`[0/6]`); the diff shows both until that one merges.

`_read_datasource_v2` in `read_api.py` reads four attributes and calls
one
method that `DataSourceV2` never declared. Parquet defines them all, so
it
worked; any other datasource that implemented only the abstract methods
failed
with `AttributeError` inside the read code. After this PR, implementing
the
abstract members of `DataSourceV2` is enough for a new datasource to
work end
to end, and a missing one is reported at construction. No behavior
change for
Parquet.

```mermaid
flowchart LR
  R[read_api._read_datasource_v2] -->|reads paths, filesystem, file_extensions, shuffle; calls _get_file_indexer| D[DataSourceV2 base class]
  D -->|abstract: paths, filesystem, _get_file_indexer| S[new datasource subclass]
  D -->|default None: file_extensions, shuffle| S
```

### Changes

1. Declare everything the read code uses on `DataSourceV2`: `paths`,
`filesystem`, `_get_file_indexer` abstract; `file_extensions`, `shuffle`
   default `None`.
2. `filesystem` may be `None`, for sources that read through their own
   library (PyIceberg, Lance, hudi-rs).
3. `FileScanner.prune_manifest` → `Scanner.prune_input_split`, so
partition
   pruning runs for every scanner, not only `FileScanner` subclasses.
4. `FileIndexer` docstring updated for the per-file listing contract
left
   after ray-project#66244.

## Additional information

Not a duplicate: no open PR changes the `DataSourceV2` base class.
ray-project#65887 and
ray-project#65888 also touch `file_indexer.py` / `listing_utils.py`, so expect
small merge
conflicts there.

Tests run locally from this branch (macOS, `~/ray/.venv`), from
`python/ray/data`:

```
pytest -q tests/unit/datasource_v2                     # 119 passed
pytest -q tests/datasource/test_read_parquet_v2.py     # 37 passed
pytest -q tests/datasource/test_parquet.py             # 246 passed, 13 skipped, 34 errors
```

The 34 errors are moto `s3_fs` fixture setup errors (`moto_server` not
on
PATH), identical on master. `ruff`, `black` and `pydoclint` at the
pre-commit
pins are clean; `pyrefly` reports the same pre-existing errors as the
base
commit.

Written with Claude Code; I reviewed every changed line and ran the
tests above.

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

---------

Signed-off-by: Aarrya <[email protected]>
Co-authored-by: Claude Fable 5.1 <[email protected]>
goutamvenkat-anyscale pushed a commit that referenced this pull request Oct 8, 2026
…as a DSv2 synthesized column (#66732)

## Why are these changes needed?

Job-level checkpointing (`CheckpointConfig(id_column=...)`) needs a
unique ID column in the input. Many batch-inference datasets don't have
one. Ray Data generates a stable ID for every row from where it lives in
its Parquet file, and a resumed job skips committed work at the source.

This is a redo of #65885, which was reverted (#66183) so the DSv2 reorg
could land first. The reorg added the seams this needs
(`SynthesizedColumn`, `ReadUnit`, the `excluded_read_unit_ids` listing
hook), so this version adds **no reader code** for the ID itself.

This PR (1/4) adds the config and the ID column. Restore comes in 3/4.

## What changes

- **`CheckpointConfig(generated_id_column=...)`**, exactly one of
`id_column` / `generated_id_column`. The generated name is also exposed
as `id_column`, so the existing checkpoint write (two-phase commit)
works unchanged.
- **`GeneratedIdColumn`** (`checkpoint/generated_id.py`), a
`SynthesizedColumn` with `requires_read_unit_boundaries = True`. It
builds a struct ID per row from the batch's `ReadUnitPosition`:
`path_prefix`, `file_name`, `fragment` (row group), `num_fragments`,
`num_rows`, `row_id` (position in the row group).
- **Whole-file guard:** if a batch comes from a whole-file read unit (no
row-group info), the column raises instead of writing IDs that can't
name a row group. Parquet always lists by footer today, so this isn't
reachable in normal reads.
- **Explicit plumbing, no public API change:** `read_parquet` builds the
column from the checkpoint config and passes it to
`ParquetDatasourceV2(extra_synthesized_columns=...)`. Ray Data's own
checkpoint reads opt out with an internal
`_add_generated_id_column=False`, popped from `**arrow_parquet_args`
like the existing `_block_udf`. Checkpoint files are Parquet too and
must never get the column.
- **Name clash:** `ParquetDatasourceV2.infer_schema` raises if a file
already has a column with the requested name, instead of silently
replacing user data the way `path` / `row_hash` do.
- **Safe on its own:** until 3/4 wires up restore, the planner plans
only the checkpoint write for generated-ID configs (plus cleanup of a
crashed run's pending checkpoints). A rerun redoes every row instead of
sending struct IDs into the numpy-based `id_column` filter.

## Related issue number

N/A. Not a duplicate: I searched open PRs for `generated_id_column`,
"row group checkpoint", `excluded_rows` and
`requires_read_unit_boundaries`. The only matches are my earlier
pre-reorg drafts #65886–#65888, which this stack replaces and which I'm
closing.

**Stack:** 1/4 (this, #66732) → 2/4 (#66733) → 3/4 (#66736) is the
feature chain. 4/4 (#66734) is an independent speed-up that lands last.

## Checks

- [x] I've signed off every commit (DCO).
- [x] I've run pre-commit (`ruff`, `black`, `pydoclint`, Ray import/doc
style) on all changed files: clean. The API-annotation check
(`ci/lint/check_api_annotations.py`, scoped to `ray.data`) reports
nothing unannotated.
- [x] AI assistance (Claude Code) was used for the development of this
PR. I, Abhishek Verma, am the human submitter signing off on it: I have
reviewed every changed line, run the tests below locally, and can defend
the change end-to-end.
- Testing (macOS, nightly wheel + this branch's `ray/data`):
- `pytest
python/ray/data/tests/unit/datasource_v2/test_generated_id_column.py`:
10 passed. Covers ID fields per row group, uniqueness across files and
row groups, `row_id` continuing across batches, determinism under a
pushed-down filter, whole-file guard, projection, schema advertisement,
name clash, and no-op without config.
- `pytest python/ray/data/tests/test_checkpoint.py` (run from
`python/ray/data/tests/`): 88 passed, 1 failed. The failure,
`test_skip_checkpoint_flag[s3]`, is a pre-existing local moto-S3 timing
flake that also fails on unmodified master. New tests: config
validation, `read_parquet` adds the column and the checkpoint read opts
out, rerun redoes rows with no filter op planned, pending-checkpoint
cleanup before rerun (verified it fails without the fix).
- `pytest python/ray/data/tests/unit/datasource_v2
python/ray/data/tests/datasource_v2`: 214 passed.

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

Signed-off-by: Abhishek Verma <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
goutamvenkat-anyscale pushed a commit that referenced this pull request Oct 16, 2026
…ng committed work at the source (#66736)

Follow-up to 1/4 (#66732) and 2/4 (#66733), both merged. 4/4 (#66734) is
an independent speed-up that lands last; this PR doesn't need it.

## Why are these changes needed?

This switches the feature on. A resumed `generated_id_column` job now
skips work it already committed, as early as possible. It doesn't run
the actor-pool `CheckpointFilter` that the `id_column` path applies to
every row.

## What changes

- **Planner routing** (`planner.py`). Generated-ID jobs get:
- `ListFiles` → `plan_list_files_op_with_done_read_units`: passes the
checkpoint's done unit ids as `EXCLUDED_READ_UNIT_IDS_KWARG_NAME` (the
hook from #66398). Fully committed files are never listed, and fully
committed row groups are never read.
- `ReadFiles` → `plan_read_files_op_with_done_rows`: the normal read
followed by a `DropCommittedRows` step for row groups that were only
partly committed.
- Each row's generated ID names its file, row group and `row_id`, so the
step looks up the row group's mask and drops rows where `mask[row_id]`
is set.
- The step fuses into the read task
(`ReadFilesParquetV2->DropCommittedRows->...`), so no extra stage runs.
- Thanks @AarryaSaraf for suggesting this over a new reader hook (the
former 4/5, #66735, now closed).
- The checkpoint's masks arrive as an Arrow table; each task indexes
them once (`_partial_mask_lookup`) and reuses the lookup for every
block. Masks stay numpy.
  - `Write` → the existing checkpoint two-phase commit.
- The `id_column` path is unchanged. 1/4's interim write-only gate is
removed.
- **Listing accepts Arrow ids** (`listing_utils.py`): the checkpoint
passes done unit ids as an Arrow array. Listing converts them to Python
strings before building its lookup set; a set built straight from an
Arrow array would hold Arrow values and never match.
  
- **Loading:** `LoadCheckpointCallback` loads the checkpoint once when
execution starts (`load_generated_id_checkpoint`, from 2/4). Both plan
functions read it through task kwargs set lazily
(`add_map_task_kwargs_fn`), because it isn't loaded at planning time. A
crashed run's pending checkpoints are still cleaned up while planning,
before the load.
- **Runs that don't restore** (`CheckpointConfig._should_restore`, from
#66563): after a successful run sets it to `False` (e.g. later training
epochs), the planner plans only the checkpoint write, as for
`id_column`, and `LoadCheckpointCallback` skips loading the generated-ID
checkpoint, since no operator reads it.
- **Validation:** plans whose sources aren't V2 Parquet reads
(`ReadFiles` over a `ParquetScanner`) raise `InvalidCheckpointingConfig`
with a pointer to `id_column`. This covers the V1 `Read` path and
non-Parquet V2 scanners.
- **Docs:** a "Checkpoint without an ID column" section in
`doc/source/data/execution-configurations.md`.

Note: like the `id_column` path's filter, `DropCommittedRows` runs after
the read, so a `limit` pushed into the read counts rows before they're
dropped.

## Related issue number

N/A. Not a duplicate (see 1/4). Replaces my pre-reorg drafts #65886,
#65887 and #65888.

## Checks

- [x] I've signed off every commit (DCO).
- [x] I've run pre-commit on all changed files: clean. `vale` (v3.17.1,
as in CI) on the docs page: 0 errors, 0 warnings, 0 suggestions.
- [x] AI assistance (Claude Code) was used for the development of this
PR. I, Abhishek Verma, am the human submitter signing off on it: I have
reviewed every changed line, run the tests below locally, and can defend
the change end-to-end.
- Testing:
- `pytest python/ray/data/tests/unit/test_generated_id_checkpoint.py`:
15 passed. New: masked rows dropped per row group in a block mixing row
groups and files; rows past a short mask kept; no matching mask means no
change; mask lookup across table chunks.
- `test_read_units.py`: listing skips done units whether the ids arrive
as a set, an Arrow array, or a chunked array. The Arrow cases fail
without the conversion.
- With `_should_restore=False`, a run ignores the kept checkpoint, reads
every row, never loads the checkpoint, and still writes checkpoints. I
checked that this test fails without the callback fix.
- On current master, `pytest python/ray/data/tests/test_checkpoint.py
python/ray/data/tests/test_data_iterator_checkpointer.py
python/ray/data/tests/unit/test_generated_id_checkpoint.py
python/ray/data/tests/unit/datasource_v2`: 299 passed, 1 failed. The
failure, `test_skip_checkpoint_flag[s3]`, is a pre-existing local
moto-S3 flake that also fails on unmodified master.
  - New end-to-end tests in `python/ray/data/tests/test_checkpoint.py`:
- Crash partway, then rerun: no missing rows, and the checkpoint is
deleted on success.
- Resume skips a fully committed file, a committed row group, and the
committed rows of a partly committed row group, and reads a never-seen
file in full. The output is exactly the uncommitted rows. I checked that
this test fails with `DropCommittedRows` disabled.
    - A rerun after a full success writes nothing.
- The plan has no `CheckpointFilter` op, and `DropCommittedRows` is
fused into the read.
    - Non-Parquet and V1 inputs are rejected.
- `pytest python/ray/data/tests/unit/test_generated_id_checkpoint.py`:
15 passed. New: masked rows dropped per row group in a block mixing row
groups and files; rows past a short mask kept; no matching mask means no
change; mask lookup across table chunks.
- Block sizing: a `generated_id_column` read produces the same number of
blocks per task as a plain read (`DropCommittedRows` keeps
`target_max_block_size`).
- `test_read_units.py`: listing skips done units whether the ids arrive
as a set, an Arrow array, or a chunked array. The Arrow cases fail
without the conversion.
- With `_should_restore=False`, a run ignores the kept checkpoint, reads
every row, never loads the checkpoint, and still writes checkpoints. I
checked that this test fails without the callback fix.
- On current master, `pytest python/ray/data/tests/test_checkpoint.py
python/ray/data/tests/test_data_iterator_checkpointer.py
python/ray/data/tests/unit/test_generated_id_checkpoint.py
python/ray/data/tests/unit/datasource_v2`: 299 passed, 1 failed. The
failure, `test_skip_checkpoint_flag[s3]`, is a pre-existing local
moto-S3 flake that also fails on unmodified master.
- `pytest python/ray/data/tests/unit
python/ray/data/tests/datasource_v2`: 1500 passed.
- Five modules didn't collect locally for missing optional dependencies
(torch, pyiceberg, freezegun).
- Two failures in `test_dynamic_work_queue.py`, which also fail on
unmodified master.
- **Together with 4/4** (local combined branch): 237 DSv2/unit and 38
checkpoint tests passed. In a manual resume run (4 files × 4 row groups,
16 write tasks), I deleted 6 committed checkpoint files and the rerun
wrote **exactly those 6,000 rows**.

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

Signed-off-by: Abhishek Verma <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
goutamvenkat-anyscale pushed a commit that referenced this pull request Oct 31, 2026
…mark (#66680)

> Stacked on #66562 (and #66563). Only review the last commit: "[Train]
Add mid-epoch resumption release test".

## Description

Adds a nightly release test for mid-epoch resumption with data iterator
checkpointing: `mid_epoch_resume_benchmark_{10M,3B}`.

`release/train_tests/mid_epoch_resume_benchmark/microbenchmark.py` runs
a `TorchTrainer` with 16 mock-GPU workers over a Parquet dataset of 10M
or 3B rows, using `DataConfig(dataset_checkpoint_configs={"train":
DatasetCheckpointConfig(id_column="id", ...)})`.
- It saves a data checkpoint with `DataIterator.state_dict()` every
`checkpoint_interval` batches and at the end of each epoch, and stores
it in the Ray Train checkpoint.
- It injects a failure 90% of the way through the epoch
(`--error_at=0.9`) and resumes from the latest checkpoint with
`ray.train.get_dataset_shard("train", state_dict=...)`.
- **Correctness:** after training, it checks that each epoch's
checkpoint files cover exactly `total_dataset_rows` rows, so every row
is seen exactly once per epoch, even across the restart.
- **Performance:** it reports the total duration and the time to first
batch with and without a data checkpoint, which includes the checkpoint
load time.

Release test config:
- One test entry with a `scale` matrix (`10M`, `3B`), nightly, `byod:
gpu`, `anyscale_sdk_2026: true`, and a 2700s timeout.
- Compute configs (`compute_configs/{10M,3B}.yaml`): an `m5.2xlarge`
head node with no CPUs, plus 10 or 50 `m5.8xlarge` workers with
`MOCK_GPU: 4` and a 64 GB object store.
- `--generate_id_column` is supported by the script but not passed,
since `DatasetCheckpointConfig(generate_id_column=True)` isn't
implemented yet (it depends on #65885–#65888).

## Related issues

Not a duplicate: there's no existing release test for data iterator
checkpointing or mid-epoch resumption.

Generated ID column support (and `--generate_id_column` in this release
test) is stacked on this PR: #66800

## Additional information

Testing:
- `pre-commit run` on the changed files: passed.
- The release test itself hasn't been run yet. I'll trigger it before
marking this ready.

AI assistance (Claude Code) was used to develop this change.

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

Signed-off-by: Justin Yu <[email protected]>
richardliaw pushed a commit that referenced this pull request Nov 6, 2026
…, row_id (#66654)

## Description

Part 1 of 3 of the `read_mcap` move to Datasource V2, based on master.
#67166 is stacked on it, and #67167 on #67166. The rest of the
`read_mcap` stack (#67189 onward) sits on top.

**Problem.** One task reads one whole file:

- Parallelism is capped by the file count: ten 30 GB recordings are ten
tasks.
- Every file is opened, even when its index shows it holds nothing
selected.
- Rows have no stable id, so a checkpointed pipeline cannot resume.

**Change.** `read_mcap` moves to Datasource V2, on by default as for
`read_parquet` (`DataContext.use_datasource_v2`). The legacy datasource
stays as the fallback.

```
files
  │  listing: read each file's index (a few ranged reads)
  │           one row per chunk, weighted by the memory reading it takes
  │           drop chunks that cannot match topics / time_range
  ▼
chunk rows
  │  packing: about 128 MiB per read task
  │           one big file ──► many tasks;  small files ──► one task
  │           with preserve_order: one task per file, in listing order
  ▼
read tasks: seek to their chunks, merge them by log time
```

- New code lives in `datasource_v2/formats/mcap/`. The V2 interfaces do
not change.
- Columns and types match the legacy path, with two changes.
`schema_data` is dictionary-encoded. A new `channel_metadata` column
holds each channel's metadata map as JSON text, dictionary-encoded, so a
block stores it once per channel.
- `data` holds decoded JSON only when every selected channel is JSON.
Otherwise it holds bytes. Planning types it from the selected messages
of the first chunk that holds one, as a read task types the messages it
holds.
- `row_id` is `<path>#c=<chunk offset>:<index>`, stable however the read
is split. It is on with `include_row_id=True`, or automatically under
`CheckpointConfig(id_column="row_id")`.
- New `log_time_order` argument, default `True`. Each task returns each
of its files in `log_time` order. With `preserve_order`, each file is
read by one task, so it comes out in order from start to end, and files
come out in the order they were listed. #67166 splits a large file there
too, only where its order holds.
- A file whose summary cannot be read gets a read task of its own, so
`max_errored_blocks` can skip it alone.
- The task size is `RAY_DATA_MCAP_BIN_PACKING_BYTES` (128 MiB).

**Changed after the first review round.** Each is its own commit:

- Summaries and chunks are read in a few ranged requests, not a few
bytes per GET.
- An unreadable file gets a read task of its own.
- Tables are built column by column, cut counting every column, and
chunks are weighted by the memory reading them takes.
- The read stops at the row limit.
- A file without a chunk index is sorted by log time.
- `channel_metadata` is JSON text, stored once per block.
- With `preserve_order`, each file is kept in one read task, and files
keep their listing order.
- Planning skips a chunk it cannot decode, and types `data` from the
first chunk's messages.

**Measured** on an 845 MB recording with 1,052 chunks: reading its 125
KB summary took about 20,000 GETs and now takes 3.

**Decisions to confirm:**

- Splitting is on by default. Block boundaries change; rows do not.
- With `preserve_order`, this PR reads each file in one task, as the
legacy reader does. #67166 lets it split a large file where its log-time
order holds.
- `ds.schema()` comes from the first chunk that holds a selected
message. A field that first appears later is missing from it; the
docstring says so.

## Related issues

- Related to #65640 and #65641.
- No open PR moves MCAP to Datasource V2. #66524 (ORC) and #66182
(Iceberg) are other formats moving to V2.
- The generated-ID stack (#65886 to #65888) is orthogonal.
- `log_time_order` comes from my #66653, now closed. My legacy-path PRs
#65912, #65913 and #65916 are closed in favour of this one.

## Additional information

```
PYTHONPATH=python/ray/data/tests pytest python/ray/data/tests/datasource/test_mcap.py \
  python/ray/data/tests/unit/datasource_v2/test_mcap_*.py \
  python/ray/data/tests/unit/datasource_v2/test_online_bin_packer.py
```

178 passed, 3 skipped. pre-commit and pyrefly clean.

AI assistance (Claude Code) was used to draft this change; I reviewed
every line and ran the tests above locally.

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

---------

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants