Skip to content

Commit

Permalink
Fix the lazy fanout test (#31726)
Browse files Browse the repository at this point in the history
This is fixing lazy fanout failure in new bulk execution backend (#30903).

It turns out we can have a smaller fix (than making Dataset lazy-only: #31668) for lazy fanout.
  • Loading branch information
jianoaix authored Jan 18, 2023
1 parent ce32b3e commit 705fbc1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions python/ray/data/_internal/block_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ def __init__(
# eagerly deleted after read by the consumer.
self._owned_by_consumer = owned_by_consumer

def __repr__(self):
return f"BlockList(owned_by_consumer={self._owned_by_consumer})"

def get_metadata(self, fetch_if_missing: bool = False) -> List[BlockMetadata]:
"""Get the metadata for all blocks."""
return self._metadata.copy()
Expand Down
3 changes: 3 additions & 0 deletions python/ray/data/_internal/lazy_block_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ def __init__(
self._owned_by_consumer = owned_by_consumer
self._stats_actor = _get_or_create_stats_actor()

def __repr__(self):
return f"LazyBlockList(owned_by_consumer={self._owned_by_consumer})"

def get_metadata(self, fetch_if_missing: bool = False) -> List[BlockMetadata]:
"""Get the metadata for all blocks."""
if all(meta is not None for meta in self._cached_metadata):
Expand Down
4 changes: 2 additions & 2 deletions python/ray/data/tests/test_optimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,9 @@ def inc(x):
ray.get(map_counter.reset.remote())
# The source data shouldn't be cleared since it's non-lazy.
ds = ray.data.from_items(list(range(10)))
# Add extra transformation before being lazy.
ds = ds.map(inc)
# Add extra transformation after being lazy.
ds = ds.lazy()
ds = ds.map(inc)
ds1 = ds.map(inc)
ds2 = ds.map(inc)
# Test content.
Expand Down

0 comments on commit 705fbc1

Please sign in to comment.