Skip to content
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

Forward worker exceptions and exit with it #1003

Closed
wants to merge 13 commits into from
Closed

Conversation

priyaramani
Copy link
Contributor

@priyaramani priyaramani commented Feb 9, 2023

When a worker thread fails in PrototypeMultiProcessingReadingService, exception was silently neglected and the thread hanged. This PR fixes that by catching and propagating exception to response queue, showing that to user and exiting the process instead of hanging.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 9, 2023
torchdata/dataloader2/communication/iter.py Outdated Show resolved Hide resolved
torchdata/dataloader2/communication/iter.py Outdated Show resolved Hide resolved
torchdata/dataloader2/communication/iter.py Outdated Show resolved Hide resolved
Copy link
Contributor

@ejguan ejguan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For lint error, can you please follow https://github.com/pytorch/data/blob/main/CONTRIBUTING.md#code-style to fix them automatically?

torchdata/dataloader2/communication/iter.py Outdated Show resolved Hide resolved
Copy link
Contributor

@ejguan ejguan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to rebase onto main branch again. I have already renamed PrototypeMultiProcessingReadingService to MultiProcessingReadingService

test/dataloader2/test_dataloader2.py Outdated Show resolved Hide resolved
test/dataloader2/test_dataloader2.py Outdated Show resolved Hide resolved
Copy link
Contributor

@NivekT NivekT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall with some questions:

torchdata/datapipes/iter/util/prefetcher.py Show resolved Hide resolved
dp = MakeMistakeDataPipe(dp)
for worker_prefetch_cnt in [0, 5, 10]:
for num_workers in [1, 4]:
rs = MultiProcessingReadingService(num_workers=num_workers, worker_prefetch_cnt=worker_prefetch_cnt)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if there is a DataPipe after Prefetcher? Does it still work properly?

e.g. dp.map().prefetch().map()

@facebook-github-bot
Copy link
Contributor

@priyaramani has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@priyaramani merged this pull request in b717187.

@NivekT NivekT mentioned this pull request Mar 20, 2023
@andrewkho andrewkho deleted the forwarderror branch September 26, 2024 04:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants