From 6bcea571bb164168f0d4d6e957f0f0d43f4dd2cd Mon Sep 17 00:00:00 2001 From: lxbhahaha <1580622474@qq.com> Date: Sun, 7 Apr 2024 14:25:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E7=BB=98=E5=88=B6?= =?UTF-8?q?=E7=BB=93=E6=9E=9C=E6=97=B6=E8=BF=98=E6=98=AF=E4=B8=8A=E4=B8=80?= =?UTF-8?q?=E6=AC=A1=E7=9A=84=E7=BB=93=E6=9E=9C=E6=98=BE=E7=A4=BA=E4=B8=80?= =?UTF-8?q?=E4=B8=AAX?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- check.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/check.py b/check.py index 31ec3d7..3afa9ec 100644 --- a/check.py +++ b/check.py @@ -257,11 +257,20 @@ def get_table_res(data_list): title = data['server_data']['title'] info_list = data.get('info_list', None) if info_list: + updated = data.get('updated', False) + data['updated'] = False + # data_list[i]['updated'] = False for j, info in enumerate(info_list): str_list = [] + # 显示是否正常更新 str_list.append(table_icon['vline']) - str_list.append(clamp_str(' ', cell_width_list[0], True)) + if updated: + str_list.append(clamp_str(' ', cell_width_list[0], True)) + else: + updated_str = clamp_str('X', cell_width_list[0], True) + updated_str = f'{COLOR_RED}{updated_str}{END_COLOR}' + str_list.append(updated_str) str_list.append(table_icon['vline']) # 显卡名称 @@ -291,16 +300,6 @@ def get_table_res(data_list): str_list.append(table_icon['vline']) # 占用情况 - # if used_mem < 1000 and util_gpu < 20: - # status = COLOR_GREEN + 'free' + END_COLOR - # text_len = 5 - # elif used_mem / total_mem < 0.5: - # status = COLOR_YELLOW + 'occupied' + END_COLOR - # text_len = 9 - # else: - # status = COLOR_RED + 'occupied' + END_COLOR - # text_len = 9 - # str_list.append(clamp_str(f" {status}", cell_width_list[1]-5, True, 'left', text_len)) temperature_len = 4 # 设置文字 if used_mem < 1000 and util_gpu < 20: @@ -403,6 +402,7 @@ def keep_check_one(server: dict, shared_data_list: list, server_idx: int, interv with data_list_lock: # locked = True shared_data_list[server_idx]['info_list'] = result + shared_data_list[server_idx]['updated'] = True # locked = False except: shared_data_list[server_idx].pop('info_list')