From 224d38cbb275057f5558ee85c1a7a007cfedcc58 Mon Sep 17 00:00:00 2001 From: Robert Nishihara Date: Thu, 30 Aug 2018 11:08:24 -0700 Subject: [PATCH] Name Python threads. (#2767) --- python/ray/import_thread.py | 2 +- python/ray/profiling.py | 4 +++- python/ray/worker.py | 9 +++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/python/ray/import_thread.py b/python/ray/import_thread.py index 669ff38a4..659cdf1ce 100644 --- a/python/ray/import_thread.py +++ b/python/ray/import_thread.py @@ -35,7 +35,7 @@ class ImportThread(object): def start(self): """Start the import thread.""" - t = threading.Thread(target=self._run) + t = threading.Thread(target=self._run, name="ray_import_thread") # Making the thread a daemon causes it to exit # when the main thread exits. t.daemon = True diff --git a/python/ray/profiling.py b/python/ray/profiling.py index 812f7111a..e4c2d438f 100644 --- a/python/ray/profiling.py +++ b/python/ray/profiling.py @@ -87,7 +87,9 @@ class Profiler(object): self.lock = threading.Lock() def start_flush_thread(self): - t = threading.Thread(target=self._periodically_flush_profile_events) + t = threading.Thread( + target=self._periodically_flush_profile_events, + name="ray_push_profiling_information") # Making the thread a daemon causes it to exit when the main thread # exits. t.daemon = True diff --git a/python/ray/worker.py b/python/ray/worker.py index 9b73b4c50..bcea4e258 100644 --- a/python/ray/worker.py +++ b/python/ray/worker.py @@ -2259,10 +2259,15 @@ def connect(info, # scheduler for new error messages. if mode == SCRIPT_MODE: if not worker.use_raylet: - t = threading.Thread(target=print_error_messages, args=(worker, )) + t = threading.Thread( + target=print_error_messages, + name="ray_print_error_messages", + args=(worker, )) else: t = threading.Thread( - target=print_error_messages_raylet, args=(worker, )) + target=print_error_messages_raylet, + name="ray_print_error_messages", + args=(worker, )) # Making the thread a daemon causes it to exit when the main thread # exits. t.daemon = True