X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=executors.py;h=28507b0e8a547e9d1edc615daa5de7945edb457d;hb=1a092f01f1a945a330fe19e96a8de507823fc28e;hp=5b77a42dc3d29ca6f42673a369e23f0962343c62;hpb=5d04ec30aabad127c4eb9494a7e1be72847612e3;p=python_utils.git diff --git a/executors.py b/executors.py index 5b77a42..28507b0 100644 --- a/executors.py +++ b/executors.py @@ -152,12 +152,13 @@ class ThreadExecutor(BaseExecutor): ) result.add_done_callback(lambda _: self.histogram.add_item(time.time() - start)) result.add_done_callback(lambda _: self.adjust_task_count(-1)) + return result @overrides def shutdown(self, wait=True) -> None: if not self.already_shutdown: logger.debug(f'Shutting down threadpool executor {self.title}') - print(self.histogram) + print(self.histogram.__repr__(label_formatter='%d')) self._thread_pool_executor.shutdown(wait) self.already_shutdown = True @@ -200,7 +201,7 @@ class ProcessExecutor(BaseExecutor): if not self.already_shutdown: logger.debug(f'Shutting down processpool executor {self.title}') self._process_executor.shutdown(wait) - print(self.histogram) + print(self.histogram.__repr__(label_formatter='%d')) self.already_shutdown = True def __getstate__(self): @@ -1112,7 +1113,7 @@ class RemoteExecutor(BaseExecutor): self.heartbeat_stop_event.set() self.heartbeat_thread.join() self._helper_executor.shutdown(wait) - print(self.histogram) + print(self.histogram.__repr__(label_formatter='%d')) self.already_shutdown = True