From 5cb295556b9067518c180be7c84e34bc1caabfac Mon Sep 17 00:00:00 2001 From: Isha Devyani Chirimar Date: Fri, 12 Apr 2024 12:39:42 -0700 Subject: [PATCH] add start epoch time to TorchXEvent Summary: Add the start epoch time to the TorchXEvent class. this doesn't modify the scuba logs yet, D56037445 needs to be approved first to add to TSMLogEntry Reviewed By: Sanjay-Ganeshan Differential Revision: D56037935 --- torchx/runner/events/__init__.py | 2 ++ torchx/runner/events/api.py | 1 + 2 files changed, 3 insertions(+) diff --git a/torchx/runner/events/__init__.py b/torchx/runner/events/__init__.py index 2ebc0dc9f..d3af0b7c4 100644 --- a/torchx/runner/events/__init__.py +++ b/torchx/runner/events/__init__.py @@ -91,10 +91,12 @@ def __init__( ) self._start_cpu_time_ns = 0 self._start_wall_time_ns = 0 + self._start_epoch_time_usec = 0 def __enter__(self) -> "log_event": self._start_cpu_time_ns = time.process_time_ns() self._start_wall_time_ns = time.perf_counter_ns() + self._start_epoch_time_usec = int(time.time() * 1000) return self def __exit__( diff --git a/torchx/runner/events/api.py b/torchx/runner/events/api.py index db76f3f3d..70e8f2791 100644 --- a/torchx/runner/events/api.py +++ b/torchx/runner/events/api.py @@ -46,6 +46,7 @@ class TorchxEvent: source: SourceType = SourceType.UNKNOWN cpu_time_usec: Optional[int] = None wall_time_usec: Optional[int] = None + start_epoch_time_usec: Optional[int] = None def __str__(self) -> str: return self.serialize()