mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
[BE]: Enable RUFF TRY400 rule - log.exception (#153473)
Change logging.error to logging.exception to log additional information when relevant. A few places have slipped in logging.errors in try except since I last did a clean up here and the rule is stabilized so I am enabling it codebase wide. I have NOQA'd much of our custom exception stack trace handling for RPC calls and distributed and tried to a fix a few errors based on whether we immediately reraised it or if we didn't print any exception handling where it could be useful. Pull Request resolved: https://github.com/pytorch/pytorch/pull/153473 Approved by: https://github.com/albanD, https://github.com/cyyever
This commit is contained in:
committed by
PyTorch MergeBot
parent
7482eb217c
commit
4f4ecc583e
@ -756,7 +756,7 @@ class MultiProcessTestCase(TestCase):
|
||||
)
|
||||
sys.exit(TEST_SKIPS["generic"].exit_code)
|
||||
except Exception:
|
||||
logger.error(
|
||||
logger.error( # noqa: TRY400
|
||||
"Caught exception: \n%s exiting " "process %s with exit code: %s",
|
||||
traceback.format_exc(),
|
||||
self.rank,
|
||||
@ -791,7 +791,7 @@ class MultiProcessTestCase(TestCase):
|
||||
pipe.send(MultiProcessTestCase.Event.GET_TRACEBACK)
|
||||
pipes.append((i, pipe))
|
||||
except ConnectionError as e:
|
||||
logger.error(
|
||||
logger.error( # noqa: TRY400
|
||||
"Encountered error while trying to get traceback for process %s: %s",
|
||||
i,
|
||||
e,
|
||||
@ -818,7 +818,7 @@ class MultiProcessTestCase(TestCase):
|
||||
"Could not retrieve traceback for timed out process: %s", rank
|
||||
)
|
||||
except ConnectionError as e:
|
||||
logger.error(
|
||||
logger.error( # noqa: TRY400
|
||||
"Encountered error while trying to get traceback for process %s: %s",
|
||||
rank,
|
||||
e,
|
||||
|
Reference in New Issue
Block a user