From 458107ea4d52f11a7a9d8f53932c477f6853a30c Mon Sep 17 00:00:00 2001 From: lxb <1580622474@qq.com> Date: Sat, 16 Nov 2024 17:20:18 +0800 Subject: [PATCH] =?UTF-8?q?fixbug.=20ssh=E5=BC=82=E5=B8=B8=E6=97=B6?= =?UTF-8?q?=E7=BB=A7=E7=BB=AD=E6=B3=A1=E6=B1=A0=EF=BC=8C=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E4=B8=8D=E9=87=8D=E8=BF=9E=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app.py b/app.py index 7416c9e..8c445b6 100644 --- a/app.py +++ b/app.py @@ -117,6 +117,9 @@ def get_gpus_info(client, timeout, info_list:list=None, ignore_gpu=False): info_list.append(f'gpu user: {e}') return result + except paramiko.ssh_exception.SSHException as e: + # ssh 的异常仍然抛出 + raise except Exception as e: if info_list is not None: info_list.append(f'gpus: {e}') @@ -138,6 +141,9 @@ def get_storage_info(client, timeout, path_list, info_list:list=None): } result.append(tmp_res) return result + except paramiko.ssh_exception.SSHException as e: + # ssh 的异常仍然抛出 + raise except Exception as e: if info_list is not None: info_list.append(f'storage: {e}') @@ -156,6 +162,9 @@ def get_memory_info(client, timeout, info_list:list=None): } return result + except paramiko.ssh_exception.SSHException as e: + # ssh 的异常仍然抛出 + raise except Exception as e: if info_list is not None: info_list.append(f'memory: {e}') @@ -173,6 +182,9 @@ def get_network_info(client, timeout, interface_name, info_list:list=None): "out": float(data[1]) } return result + except paramiko.ssh_exception.SSHException as e: + # ssh 的异常仍然抛出 + raise except Exception as e: if info_list is not None: info_list.append(f'network: {e}')