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

[Train] Immediately fail if application errors on any worker #28314

Merged
merged 9 commits into from
Sep 21, 2022

Conversation

amogkam
Copy link
Contributor

@amogkam amogkam commented Sep 6, 2022

Signed-off-by: Amog Kamsetty [email protected]
Resolves https://discuss.ray.io/t/torch-trainer-gets-stuck/7447

Previously with Ray Train, if 1 worker raises an Exception in the application code, this Exception is not raised in the driver until all workers have finished executing the training function. This can lead to hanging behaviors where other workers are waiting on a collective/torch.distributed.barrier() call for example.

With this PR, if any worker fails in the application code, the entire training job is immediately terminated and the exception is raised on the driver.

Why are these changes needed?

Related issue number

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

Signed-off-by: Amog Kamsetty <[email protected]>
Signed-off-by: Amog Kamsetty <[email protected]>
Copy link
Contributor

@krfricke krfricke left a comment

Choose a reason for hiding this comment

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

LGTM, minor comments

python/ray/train/_internal/session.py Outdated Show resolved Hide resolved
python/ray/train/constants.py Outdated Show resolved Hide resolved
python/ray/train/tests/test_trainer.py Outdated Show resolved Hide resolved
@krfricke krfricke added the @author-action-required The PR author is responsible for the next step. Remove tag to send back to the reviewer. label Sep 7, 2022
@amogkam amogkam removed the @author-action-required The PR author is responsible for the next step. Remove tag to send back to the reviewer. label Sep 7, 2022
Signed-off-by: Amog Kamsetty <[email protected]>
Signed-off-by: Amog Kamsetty <[email protected]>
@amogkam
Copy link
Contributor Author

amogkam commented Sep 20, 2022

@krfricke can you review again please?

Signed-off-by: Amog Kamsetty <[email protected]>
Copy link
Contributor

@krfricke krfricke left a comment

Choose a reason for hiding this comment

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

LGTM

@amogkam amogkam merged commit 04cc762 into ray-project:master Sep 21, 2022
@amogkam amogkam deleted the train-immediate-error branch September 21, 2022 18:52
amogkam added a commit that referenced this pull request Nov 2, 2022
Signed-off-by: Amog Kamsetty [email protected]

Follow up to #28314

#28314 did not cover all the cases. In particular, if one worker fails, but the other workers are hanging, then our shutdown logic will also hang since it's waiting for the actors to finish running their methods. Instead, we want to force shutdown all workers regardless of if they have finished their method or not. This PR also adds an e2e integration test.
WeichenXu123 pushed a commit to WeichenXu123/ray that referenced this pull request Dec 19, 2022
Signed-off-by: Amog Kamsetty [email protected]

Follow up to ray-project#28314

ray-project#28314 did not cover all the cases. In particular, if one worker fails, but the other workers are hanging, then our shutdown logic will also hang since it's waiting for the actors to finish running their methods. Instead, we want to force shutdown all workers regardless of if they have finished their method or not. This PR also adds an e2e integration test.

Signed-off-by: Weichen Xu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants