Skip to content

Commit f7d8226

Browse files
Tony Kaofacebook-github-bot
authored andcommitted
torchx - add exception_type and exception_message to torchx event
Summary: Add exception type and message to torchx event. This allows for better logging of exception details for further analysis. Differential Revision: D64406552
1 parent 3855ae4 commit f7d8226

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

torchx/runner/events/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ def __exit__(
123123
) // 1000
124124
if traceback_type:
125125
self._torchx_event.raw_exception = traceback.format_exc()
126+
if exec_type:
127+
self._torchx_event.exception_type = exec_type.__name__
128+
if exec_value:
129+
self._torchx_event.exception_message = str(exec_value)
126130
record(self._torchx_event)
127131

128132
def _generate_torchx_event(

torchx/runner/events/api.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ class TorchxEvent:
5252
wall_time_usec: Optional[int] = None
5353
start_epoch_time_usec: Optional[int] = None
5454
workspace: Optional[str] = None
55+
exception_type: Optional[str] = None
56+
exception_message: Optional[str] = None
5557

5658
def __str__(self) -> str:
5759
return self.serialize()

0 commit comments

Comments
 (0)