-
Notifications
You must be signed in to change notification settings - Fork 714
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
log exception/backtrace when a process run in parallel fails (#3423)
What is the motivation for this PR? Currently when a Process run via parallel_run function in parallel.py fails because of an exception, we are only able to get the exit code, and fail a test. We have to dig through the debug test logs to figure out why the process failed to find the exception. How did you do it? By wrapping the multiprocessing.Process class in SonicProcess class, we can catch the exception when the Process is run by enclosing the run call in a try/catch block and storing the exception. parallel_run would then create instances of SonicProcess instead of Process. If any of the SonicProcess has an non-zero exit code, we can get the actual exception and log it. How did you verify/test it? Ran sanity check where we have an exception in a log message (using hostname1 instead of hostname). Here is the output in the log
- Loading branch information
1 parent
1562eb1
commit 9dc1c17
Showing
1 changed file
with
45 additions
and
7 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