From 4364d4b18a37035d6b93b7c26cb10963d549b1ec Mon Sep 17 00:00:00 2001 From: Dmitry Meyer Date: Thu, 7 Aug 2025 08:57:46 +0000 Subject: [PATCH] Fix `_check_instance` log spam --- .../_internal/server/background/tasks/process_instances.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/dstack/_internal/server/background/tasks/process_instances.py b/src/dstack/_internal/server/background/tasks/process_instances.py index ec3d4d387f..5be54f21ce 100644 --- a/src/dstack/_internal/server/background/tasks/process_instances.py +++ b/src/dstack/_internal/server/background/tasks/process_instances.py @@ -800,7 +800,9 @@ async def _check_instance(session: AsyncSession, instance: InstanceModel) -> Non health_status = instance.health loglevel = logging.DEBUG - if not instance_check.reachable or (check_instance_health and not health_status.is_healthy()): + if not instance_check.reachable and instance.status.is_available(): + loglevel = logging.WARNING + elif check_instance_health and not health_status.is_healthy(): loglevel = logging.WARNING logger.log( loglevel, @@ -945,7 +947,7 @@ def _check_instance_inner( except requests.RequestException as e: template = "shim.%s(): request error: %s" args = (method.__func__.__name__, e) - logger.warning(template, *args) + logger.debug(template, *args) return InstanceCheck(reachable=False, message=template % args) except Exception as e: template = "shim.%s(): unexpected exception %s: %s"