perf: 修改core celery 组件状态 (#12684)

Co-authored-by: feng <1304903146@qq.com>
This commit is contained in:
fit2bot
2024-02-22 14:47:26 +08:00
committed by GitHub
parent d4721e90d5
commit d4e53be7ce
2 changed files with 9 additions and 4 deletions

View File

@@ -3,7 +3,7 @@
from itertools import groupby
from common.utils import get_logger
from terminal.const import ComponentLoad
from terminal.const import ComponentLoad, TerminalType
logger = get_logger(__name__)
@@ -38,9 +38,13 @@ class ComputeLoadUtil:
return system_status
@classmethod
def compute_load(cls, stat):
def compute_load(cls, stat, terminal_type=None):
if not stat:
return ComponentLoad.offline
# TODO The core component and celery component will return true for the time being.
if terminal_type in [TerminalType.core, TerminalType.celery]:
return ComponentLoad.normal
else:
return ComponentLoad.offline
system_status_values = cls._compute_system_stat_status(stat).values()
if ComponentLoad.critical in system_status_values:
return ComponentLoad.critical