From 9d80a54c45f86d1fbdb74ab3b3c5a8377c90927d Mon Sep 17 00:00:00 2001 From: BobTheBuidler <70677534+BobTheBuidler@users.noreply.github.com> Date: Thu, 19 Dec 2024 13:02:08 -0400 Subject: [PATCH] feat: add thread name prefix to AsyndThreadPoolExecutor repr --- a_sync/executor.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/a_sync/executor.py b/a_sync/executor.py index 6b32aefa..45db6831 100644 --- a/a_sync/executor.py +++ b/a_sync/executor.py @@ -139,7 +139,9 @@ def _call_copy_future_state(cf_fut: "concurrent.futures.Future"): return fut def __repr__(self) -> str: - return f"<{self.__class__.__name__} object at {hex(id(self))} [{self.worker_count_current}/{self._max_workers} {self._workers}]>" + worker_info = f"[{self.worker_count_current}/{self._max_workers} {self._workers}]" + identifier = getattr(self, "_thread_name_prefix", None) or hex(id(self)) + return f"<{self.__class__.__name__} {identifier} {worker_info}>" def __len__(self) -> int: # NOTE: should this be queue length instead? probably