[DataPipe] Automatically close parent streams and discarded streams#560
Closed
VitalyFedyunin wants to merge 4 commits intogh/VitalyFedyunin/8/basefrom
Closed
[DataPipe] Automatically close parent streams and discarded streams#560VitalyFedyunin wants to merge 4 commits intogh/VitalyFedyunin/8/basefrom
VitalyFedyunin wants to merge 4 commits intogh/VitalyFedyunin/8/basefrom
Conversation
[ghstack-poisoned]
…d streams" [ghstack-poisoned]
Contributor
Author
|
Domain tests are broken because of out-of-sync torch |
NivekT
approved these changes
Jun 30, 2022
| file_obj = rar.open(info) | ||
|
|
||
| yield inner_path, StreamWrapper(file_obj) # type: ignore[misc] | ||
| yield inner_path, StreamWrapper(file_obj, stream) # type: ignore[misc] |
Contributor
There was a problem hiding this comment.
nit: Should we pass in the name here to StreamWrapper? Or there is a good reason to leave it out?
Contributor
Author
There was a problem hiding this comment.
There is no reason to skip names, they are convenient for debugging. Will add in both cases.
| extracted_fobj = lzma.open(data_stream, mode="rb") # type: ignore[call-overload] | ||
| new_pathname = pathname.rstrip(".xz") | ||
| yield new_pathname, StreamWrapper(extracted_fobj) # type: ignore[misc] | ||
| yield new_pathname, StreamWrapper(extracted_fobj, data_stream) # type: ignore[misc] |
Contributor
There was a problem hiding this comment.
nit: Pass in name to StreamWrapper?
…d streams" [ghstack-poisoned]
ejguan
approved these changes
Jun 30, 2022
Comment on lines
+114
to
+120
| for remaining in ref_it: | ||
| janitor(remaining) | ||
|
|
||
| # TODO(VItalyFedyunin): This should be Exception or warn when debug mode is enabled | ||
| if len(self.buffer) > 0: | ||
| for k, v in self.buffer.items(): | ||
| janitor(v) |
Contributor
There was a problem hiding this comment.
We should put it into try-finally since we might raise ValueError in the middle of iteration.
…d streams" [ghstack-poisoned]
Contributor
Author
|
@VitalyFedyunin has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack from ghstack (oldest at bottom):
Differential Revision: D37625298