From 4e9d232d46b2a99adbee9a288884666063f649a0 Mon Sep 17 00:00:00 2001 From: Scott Date: Mon, 24 Jan 2022 15:42:09 -0800 Subject: [PATCH] Report overall runtime in periodic status dumps. --- executors.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/executors.py b/executors.py index e092e10..dcc2180 100644 --- a/executors.py +++ b/executors.py @@ -248,8 +248,9 @@ class BundleDetails: class RemoteExecutorStatus: def __init__(self, total_worker_count: int) -> None: - self.worker_count = total_worker_count + self.worker_count: int = total_worker_count self.known_workers: Set[RemoteWorkerRecord] = set() + self.start_time: float = time.time() self.start_per_bundle: Dict[str, float] = defaultdict(float) self.end_per_bundle: Dict[str, float] = defaultdict(float) self.finished_bundle_timings_per_worker: Dict[ @@ -259,11 +260,11 @@ class RemoteExecutorStatus: self.bundle_details_by_uuid: Dict[str, BundleDetails] = {} self.finished_bundle_timings: List[float] = [] self.last_periodic_dump: Optional[float] = None - self.total_bundles_submitted = 0 + self.total_bundles_submitted: int = 0 # Protects reads and modification using self. Also used # as a memory fence for modifications to bundle. - self.lock = threading.Lock() + self.lock: threading.Lock = threading.Lock() def record_acquire_worker(self, worker: RemoteWorkerRecord, uuid: str) -> None: with self.lock: @@ -338,13 +339,14 @@ class RemoteExecutorStatus: if len(self.finished_bundle_timings) > 1: qall = numpy.quantile(self.finished_bundle_timings, [0.5, 0.95]) ret += ( - f'⏱=∀p50:{qall[0]:.1f}s, ∀p95:{qall[1]:.1f}s, ' + f'⏱=∀p50:{qall[0]:.1f}s, ∀p95:{qall[1]:.1f}s, total={ts-self.start_time:.1f}s, ' f'✅={total_finished}/{self.total_bundles_submitted}, ' f'💻n={total_in_flight}/{self.worker_count}\n' ) else: ret += ( - f' ✅={total_finished}/{self.total_bundles_submitted}, ' + f'⏱={ts-self.start_time:.1f}s, ' + f'✅={total_finished}/{self.total_bundles_submitted}, ' f'💻n={total_in_flight}/{self.worker_count}\n' ) -- 2.45.2