pytorch
8d34a832 - TorchScript to support capability to rethrow the original python exception (#77093)

Commit
2 years ago
TorchScript to support capability to rethrow the original python exception (#77093) Summary: In order to categorize exceptions/errors, the observability /migration team faced a problem that currently the exception is shown as RuntimeError, and hard to categorize. The solution to this problem is to be able to get the original python exception's class name and msg, and hopefully to recreate a python exception from that. TO support this approach, we did the following in this diff: (1) TorchScript to translate JITException so that it does not show as RuntimeError (2) record python exception class name, original message during translation. Then, later, the python exception can be reconstructed. (3) Added a new decorator to reconstruct the python exception and then rethrow it. Test Plan: buck test //caffe2/torch/fb/translate_exception/tests:test_rethrow mode/dev-tsan ``` More details at https://www.internalfb.com/intern/buck/build/1180a788-3767-48e5-a64d-06d284b91a17 BUILD SUCCEEDED Tpx test run coordinator for Facebook. See https://fburl.com/tpx for details. Running with tpx session id: 24ae6c7c-a647-404e-8f12-d12c762bf728 Trace available for this run at /tmp/tpx-20220507-195320.698499-24ae6c7c-a647-404e-8f12-d12c762bf728/trace.log RemoteExecution session id: reSessionID-24ae6c7c-a647-404e-8f12-d12c762bf728-tpx Started reporting to test run: https://www.internalfb.com/intern/testinfra/testrun/8162774413147962 ✓ ListingSuccess: caffe2/torch/fb/translate_exception/tests:test_rethrow : 3 tests discovered (27.233) ✓ Pass: caffe2/torch/fb/translate_exception/tests:test_rethrow - test_one_parameter (test_rethrow.TestTranslateRethrowPythonException) (28.467) ✓ Pass: caffe2/torch/fb/translate_exception/tests:test_rethrow - test_no_parameter (test_rethrow.TestTranslateRethrowPythonException) (28.495) ✓ Pass: caffe2/torch/fb/translate_exception/tests:test_rethrow - test_2_parameter_with_torch_script_only (test_rethrow.TestTranslateRethrowPythonException) (28.708) Summary Pass: 3 ListingSuccess: 1 If you need help understanding your runs, please follow the wiki: https://fburl.com/posting_in_tpx_users Finished test run: https://www.internalfb.com/intern/testinfra/testrun/8162774413147962 ``` Differential Revision: D36166520 Pull Request resolved: https://github.com/pytorch/pytorch/pull/77093 Approved by: https://github.com/qihqi
Author
Committer
Parents
Loading