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}')