-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Properly cleanup processes and queues for MPRS and Fix
pause
for pr…
…efetch (#1096) Summary: Pull Request resolved: #1096 Fixes issue about `MPRS.finalize` when `dataloader2.shutdown()` is called ### Changes - DataLoader2 should always clean up `datapipe_iter` at shutdown - Guard `MPRS` to finalize once - Fix the problem of `ConnectionError` when DataLoader early exits - This is caused by `queue` is joined when main/worker/dispatching process exits. No more request/response can be passed across processes. - Consumer process shouldn't join the `req_queue` at exit to make sure producer process can still access the remaining request. And, consumer will close `req_queue` after clean up to prevent any further request sent to queue. - Produce process shouldn't join the `res_queue` at exit to make sure consumer process can still access response. And, producer will close `res_queue` after clean up to prevent any further response sent to queue. - Main (Consumer) <-> Worker (Producer) - Worker (Consumer) -> Dispatching (Producer) - Fix `pause` API for DataLoader2 - Invoke `pause` lazily until the `limit+1` iteration is reached to align with python's iterator behavior. - Make `prefetch.pause` blocking unless there might be potential racing issue. Main thread is paused but prefetch worker is still trying to fetch data from `iter`. - Add tests to validate Pull Request resolved: #1075 Reviewed By: NivekT Differential Revision: D44168655 Pulled By: ejguan fbshipit-source-id: fdfee5c27b512b5c0d5308e53a81b1cb2db70a43
- Loading branch information
Showing
7 changed files
with
126 additions
and
40 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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