-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(utility): add lock for cached file between processes
When using PyTorch dataloader with multiple workers, the cache file will be accessed by different processes. And the cache file can be written and read at the same time, which would lead to the read content being empty. Thus, use a temp filename while writing the cache file and then change it to the cache path. And add a lock to avoid repeatedly writing cache. PR Closed: #1151
- Loading branch information
Showing
2 changed files
with
72 additions
and
17 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