Skip to content

Commit

Permalink
feat: add thread name prefix to AsyndThreadPoolExecutor repr (#500)
Browse files Browse the repository at this point in the history
  • Loading branch information
BobTheBuidler authored Dec 19, 2024
1 parent 2ba6752 commit 8bdf8ea
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion a_sync/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8bdf8ea

Please sign in to comment.