Skip to content
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] Deprecate prefetch_batches arg of iter_rows and change default value #44982

Merged
merged 2 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion python/ray/data/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -3611,7 +3611,7 @@ def iterator(self) -> DataIterator:

@ConsumptionAPI
def iter_rows(
self, *, prefetch_batches: int = 0, prefetch_blocks: int = 0
self, *, prefetch_batches: int = 1, prefetch_blocks: int = 0
) -> Iterable[Dict[str, Any]]:
"""Return an iterable over the rows in this dataset.

Expand Down
6 changes: 5 additions & 1 deletion python/ray/data/iterator.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def _get_dataset_tag(self) -> str:
return "unknown_dataset"

def iter_rows(
self, *, prefetch_batches: int = 0, prefetch_blocks: int = 0
self, *, prefetch_batches: int = 1, prefetch_blocks: int = 0
) -> Iterable[Dict[str, Any]]:
"""Return a local row iterable over the dataset.

Expand Down Expand Up @@ -234,6 +234,10 @@ def iter_rows(
DeprecationWarning,
)
iter_batch_args["prefetch_batches"] = prefetch_blocks
if prefetch_batches != 1:
warnings.warn(
"`prefetch_batches` is deprecated in Ray 2.12.", DeprecationWarning
)

batch_iterable = self.iter_batches(**iter_batch_args)

Expand Down
Loading