Repository navigation
Resolve DaskRunner side input OOM by iteratively computing delayed partition #40283
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -87,13 +87,24 @@ class DaskBagWindowedIterator: | |
|
|
||
| bag: db.Bag | ||
| window_fn: WindowFn | ||
| lazy_side_inputs: bool = False | ||
|
|
||
| def __iter__(self): | ||
| # FIXME(cisaacstern): list() is likely inefficient, since it presumably | ||
| # materializes the full result before iterating over it. doing this for | ||
| # now as a proof-of-concept. can we can generate results incrementally? | ||
| for result in list(self.bag): | ||
| yield get_windowed_value(result, self.window_fn) | ||
| if not self.lazy_side_inputs: | ||
| for result in list(self.bag): | ||
| yield get_windowed_value(result, self.window_fn) | ||
| else: | ||
| try: | ||
| from dask.distributed import worker_client | ||
| with worker_client() as client: | ||
| for partition in self.bag.to_delayed(): | ||
| # explicitly submit and wait to avoid deadlock | ||
| for result in client.compute(partition).result(): | ||
| yield get_windowed_value(result, self.window_fn) | ||
| except (ImportError, ValueError): | ||
| for partition in self.bag.to_delayed(): | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do you anticipate a particular scenario when we hit the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for transient errors , runners should retry. for non-transient errors, a user can remove the flag. |
||
| for result in partition.compute(): | ||
| yield get_windowed_value(result, self.window_fn) | ||
|
|
||
|
|
||
| @dataclasses.dataclass | ||
|
|
||
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.
Could you preserve the original comment for context?
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.
feel free to expand on that as appropriate.