Skip to content

(torchx/local_scheduler) Use os.kill instead of os.killpg when sending SIGTERM to the replica pid. Add runner.wait() for torchx.runner.test.api_test#test_empty_session_id to gracefully wait for the replicas to finish running #1062

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

Merged
merged 1 commit into from
May 5, 2025

Conversation

kiukchung
Copy link
Contributor

Summary:
Fixes macos unittest failures: https://github.com/pytorch/torchx/actions/runs/14844253481/job/41674243877

When looking into the test failure I noticed two things:

  1. local_scheduler was trying to SIGTERM the process group by passing the replica's pid: os.killpg(replica.pid, signal.SIGTERM) . Changed to call os.kill. (note that os.killpg is not available on iOS which is why the test was failing).

  2. The torchx.runner.test.api_test.test_empty_session_id() test case doesn't wait for the echo test command to finish hence there was a race condition where in certain cases the runner's __exit__() SIGTERMs the replica pids but since the local_scheduler was (wronfully) using os.killpg not os.kill it threw an uncaught error in iOS.

Differential Revision: D74197282

…g SIGTERM to the replica pid. Add runner.wait() for torchx.runner.test.api_test#test_empty_session_id to gracefully wait for the replicas to finish running

Summary:
Fixes macos unittest failures: https://github.com/pytorch/torchx/actions/runs/14844253481/job/41674243877

When looking into the test failure I noticed two things:

1. `local_scheduler` was trying to SIGTERM the process group by passing the replica's pid:  `os.killpg(replica.pid, signal.SIGTERM)` . Changed to call `os.kill`. (note that `os.killpg` is not available on iOS which is why the test was failing).

2. The `torchx.runner.test.api_test.test_empty_session_id()` test case doesn't wait for the `echo` test command to finish hence there was a race condition where in certain cases the runner's `__exit__()` SIGTERMs the replica pids but since the `local_scheduler` was (wronfully) using `os.killpg` not `os.kill` it threw an uncaught error in iOS.

Differential Revision: D74197282
@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 May 5, 2025
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D74197282

Copy link

@highker highker left a comment

Choose a reason for hiding this comment

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

I just want to try again

@facebook-github-bot facebook-github-bot merged commit 8216ac4 into pytorch:main May 5, 2025
24 checks passed
facebook-github-bot pushed a commit that referenced this pull request May 5, 2025
Summary: Reverting the os.killpg -> os.kill part of #1062.

Reviewed By: d4l3k

Differential Revision: D74205288
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. fb-exported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants