From d429c98d3a261e9a033a8ad7eec40ec15fd54de9 Mon Sep 17 00:00:00 2001 From: Chi Song Date: Thu, 22 Sep 2022 10:25:42 -0700 Subject: [PATCH] runner: reduce duplicate logs. --- lisa/runner.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/lisa/runner.py b/lisa/runner.py index 69edc4d52..5c1c25c78 100644 --- a/lisa/runner.py +++ b/lisa/runner.py @@ -169,6 +169,7 @@ class RootRunner(Action): # global error. self._runners: List[BaseRunner] = [] self._runner_count: int = 0 + self._idle_logged: bool = False async def start(self) -> None: await super().start() @@ -345,11 +346,11 @@ class RootRunner(Action): # later runners. continue - # remove completed runners - self._log.debug( - f"running count: {task_manager.running_count}, " - f"id: {[x.id for x in remaining_runners]} " - ) + if not self._idle_logged: + self._log.debug( + f"running count: {task_manager.running_count}, " + f"id: {[x.id for x in remaining_runners]} " + ) if task_manager.has_idle_worker(): if has_more_runner: @@ -362,10 +363,16 @@ class RootRunner(Action): self._log.debug(f"Added runner {runner.id}") except StopIteration: has_more_runner = False + + self._idle_logged = False else: # reduce CPU utilization from infinite loop when idle # workers are present but no task to run. - self._log.debug("Idle worker available but no new runner...") + if not self._idle_logged: + self._log.debug( + "Idle worker available but no new runner..." + ) + self._idle_logged = True break def _cleanup(self) -> None: