Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add thread name prefix to AsyndThreadPoolExecutor repr #500

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading