-
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] Fix the bug of eagerly clearing up input blocks #31459
Conversation
Co-authored-by: Clark Zinzow <[email protected]> Signed-off-by: Cheng Su <[email protected]>
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.
LGTM!
# Test that first map is executed twice, because ds1.fully_executed() | ||
# clears up the previous snapshot blocks, and ds2.fully_executed() | ||
# has to re-execute ds.map(inc) again. | ||
assert ray.get(map_counter.get.remote()) == 2 * 10 + 10 + 10 |
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.
Nice test!
# If not a lazy datasource, unlink the input blocks from the plan so we | ||
# can eagerly reclaim the input block memory after the first stage is | ||
# done executing. | ||
self._in_blocks = None |
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.
I think that removing this is safe, but when adding the block clearing logic for the new execution plan/model, we should be sure to have comprehensive memory releasing tests that covers all corners cases of our block clearing semantics.
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.
@clarkzinzow - agreed.
This PR is to enable lazy execution by default. See ray-project/enhancements#19 for motivation. The change includes: * Change `Dataset` constructor: `Dataset.__init__(lazy: bool = True)`. Also remove `defer_execution` field, as it's no longer needed. * `read_api.py:read_datasource()` returns a lazy `Dataset` with computing the first input block. * Add `ds.fully_executed()` calls to required unit tests, to make sure they are passing. TODO: - [x] Fix all unit tests - [x] #31459 - [x] #31460 - [ ] Remove the behavior to eagerly compute first block for read - [ ] #31417 - [ ] Update documentation
This PR is fixing the issue found in #31286. Previously we always eagerly clears up non-lazy input blocks (plan._in_blocks) when executing the plan. This is not safe as the input blocks might be used by downstream operations later. Signed-off-by: Cheng Su <[email protected]> Co-authored-by: Clark Zinzow <[email protected]>
This PR is to enable lazy execution by default. See ray-project/enhancements#19 for motivation. The change includes: * Change `Dataset` constructor: `Dataset.__init__(lazy: bool = True)`. Also remove `defer_execution` field, as it's no longer needed. * `read_api.py:read_datasource()` returns a lazy `Dataset` with computing the first input block. * Add `ds.fully_executed()` calls to required unit tests, to make sure they are passing. TODO: - [x] Fix all unit tests - [x] #31459 - [x] #31460 - [ ] Remove the behavior to eagerly compute first block for read - [ ] #31417 - [ ] Update documentation
This PR is fixing the issue found in ray-project#31286. Previously we always eagerly clears up non-lazy input blocks (plan._in_blocks) when executing the plan. This is not safe as the input blocks might be used by downstream operations later. Signed-off-by: Cheng Su <[email protected]> Co-authored-by: Clark Zinzow <[email protected]> Signed-off-by: tmynn <[email protected]>
This PR is to enable lazy execution by default. See ray-project/enhancements#19 for motivation. The change includes: * Change `Dataset` constructor: `Dataset.__init__(lazy: bool = True)`. Also remove `defer_execution` field, as it's no longer needed. * `read_api.py:read_datasource()` returns a lazy `Dataset` with computing the first input block. * Add `ds.fully_executed()` calls to required unit tests, to make sure they are passing. TODO: - [x] Fix all unit tests - [x] ray-project#31459 - [x] ray-project#31460 - [ ] Remove the behavior to eagerly compute first block for read - [ ] ray-project#31417 - [ ] Update documentation Signed-off-by: tmynn <[email protected]>
Co-authored-by: Clark Zinzow [email protected]
Signed-off-by: Cheng Su [email protected]
Why are these changes needed?
This PR is fixing the issue found in #31286. Previously we always eagerly clears up non-lazy input blocks (
plan._in_blocks
) when executing the plan. This is not safe as the input blocks might be used by downstream operations later.An example of exception:
Related issue number
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.