-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
[Datasets] [Out-of-Band Serialization: 2/3] Refactor ExecutionPlan
to maintain complete lineage and eagerly unlink block references.
#23931
Conversation
…k block references.
a4d2f71
to
b4a2cbd
Compare
Does uncommenting this line in test work after the changes here?
|
@@ -87,11 +87,13 @@ def test_spread_hint_inherit(ray_start_regular_shared): | |||
ds = ray.data.range(10)._experimental_lazy() | |||
ds = ds.map(lambda x: x + 1) | |||
ds = ds.random_shuffle() | |||
for s in ds._plan._stages: | |||
for s in ds._plan._stages_before_snapshot: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great to have more tests for this unlinking behavior as it's fairly intricate.
…lear everything if pipelining.
bb55429
to
e27926d
Compare
… lazy, clear everything if pipelining." This reverts commit d75386c.
… remove conditional copying
fa1c84b
to
f13a2da
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done, LGTM
dataset_uuid = self._dataset_uuid | ||
in_blocks = self._in_blocks | ||
if isinstance(in_blocks, BlockList): | ||
in_blocks = in_blocks.copy() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it actually deep copy? The blocklist copy API used here is a shallow copy: https://sourcegraph.com/github.com/ray-project/ray@78d6ed7/-/blob/python/ray/data/impl/block_list.py?L37
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The execution plan only consumes those BlockList
-internal lists (blocks
and metadata
), it doesn't mutate them, so it's a "deep" copy as we define it in the docstring: "This copy can be executed AND cleared without mutating the original."
This PR refactors
ExecutionPlan
to maintain complete stage lineage, even for eagerly computed datasets, while ensuring that block references are unlinked as early as possible in order to more eagerly release block memory. This PR is the final precursor to adding the actual out-of-band serialization APIs (PR 3/3).The fully lineage has to be maintained, even for eagerly computed datasets, since the lineage is needed for out-of-band serialization of datasets. See the mono-PR for more context.
Checks
scripts/format.sh
to lint the changes in this PR.