diff options
author | nicolargo <nicolas@nicolargo.com> | 2020-08-20 11:03:48 +0200 |
---|---|---|
committer | nicolargo <nicolas@nicolargo.com> | 2020-08-20 11:03:48 +0200 |
commit | d95ec00cf59c8a09afd748feed590ea48d1a7358 (patch) | |
tree | 1857a9f69f8da2f9d8e4e00b430172f1ae23bf40 | |
parent | ee2054d5024ad90aa373af857ff269531ab0b39f (diff) |
Fix gpu plugin to handle multiple gpus with different reporting capabilities #1634
-rw-r--r-- | glances/plugins/glances_gpu.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/glances/plugins/glances_gpu.py b/glances/plugins/glances_gpu.py index e0cdb96b..8c2905b1 100644 --- a/glances/plugins/glances_gpu.py +++ b/glances/plugins/glances_gpu.py @@ -2,7 +2,7 @@ # # This file is part of Glances. # -# Copyright (C) 2018 Kirby Banman <kirby.banman@gmail.com> +# Copyright (C) 2020 Kirby Banman <kirby.banman@gmail.com> # # Glances is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by @@ -226,11 +226,11 @@ class Plugin(GlancesPlugin): id_msg = '{}'.format(gpu_stats['gpu_id']) try: proc_msg = '{:>3.0f}%'.format(gpu_stats['proc']) - except ValueError: + except (ValueError, TypeError): proc_msg = '{:>4}'.format('N/A') try: mem_msg = '{:>3.0f}%'.format(gpu_stats['mem']) - except ValueError: + except (ValueError, TypeError): mem_msg = '{:>4}'.format('N/A') msg = '{}: {} mem: {}'.format(id_msg, proc_msg, |