Tangellapalli Sai Hanuma Rahul <saihanumarahu...@gmail.com> added the comment:
In summary; ========== Current Problem: ------------------ ThreadPoolExecutor handles all threads-related activities so the user needs to just submit tasks and set max_workers and other Executor settings if necessary. If ThreadPoolExecutor allowed us to name/rename threads, that would be great. Of Course, there's a workaround that requires the user to change the name of the current Thread inside the Task, but that requires the user to access the current thread which I believe is not the goal of Thread Pool Executor. Request; ---------- Changes Made: ~~~~~~~~~~~ In this Pull request, _work_queue puts tuple of Future Object and name (name can be None). i.e, typing.Tuple[_base.Future, typing. Optional[str]] which was just a _base.Future before. So, inside the _worker function, When it gets the elements and If its name is None, it will either use the thread_name_prefix or custom Name of task that was used before. else it sets the name of the current Thread with the given name. Problems it solves ~~~~~~~~~~~~~ Currently, ThreadExecutor uses thread_name_prefix + index number for the Internal Thread which is not enough for debugging when we try to submit different types of Tasks (types here mean general callable). So, using this Optional Feature which allows users to submit tasks with names it allows them to easily find issues using the name of Thread either in Logger or in the debugger. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue45689> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com