forked from aws/sagemaker-training-toolkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: Pass SIGTERM to training subprocess fix: aws#125
- Loading branch information
Showing
5 changed files
with
81 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
""" | ||
Helper script for testing signal handling | ||
- If it receives SIGTERM, immediately exit "21" | ||
- If it doesn't receive a signal, sleep for 3 seconds then exit "-1" | ||
""" | ||
|
||
import signal | ||
import time | ||
|
||
|
||
def signal_handler(signalnum, *_): | ||
assert signalnum == signal.SIGTERM | ||
exit(21) | ||
|
||
|
||
def main(): | ||
signal.signal(signal.SIGTERM, signal_handler) | ||
time.sleep(3) | ||
exit(-1) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
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