From 5f638f33a0ab6af2d8261fc61bc284001d553e97 Mon Sep 17 00:00:00 2001 From: Erwan Velu Date: Mon, 28 Oct 2024 16:19:24 +0100 Subject: [PATCH] hwgraph: Do not enable same-chassis feature for a single node MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As per issue#41, when tracing with a single server, the --same-chassis can be engaged generating a crash like: ~/Devel/hwbench (various)$ python3 -m graph.hwgraph graph --outdir criteo/arno_out --traces ~/Téléchargements/results.json:Arno:BMC.Server environment: All traces are from the same chassis (GYLGS63), enabling --same-chassis feature Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "/home/e.velu/Devel/hwbench/graph/hwgraph.py", line 380, in main() File "/home/e.velu/Devel/hwbench/graph/hwgraph.py", line 376, in main args.func(args) File "/home/e.velu/Devel/hwbench/graph/hwgraph.py", line 61, in render_traces rendered_graphs += graph_environment(args, output_dir) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/e.velu/Devel/hwbench/graph/hwgraph.py", line 234, in graph_environment rendered_graphs += graph_chassis(args, bench_name, output_dir) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/e.velu/Devel/hwbench/graph/chassis.py", line 139, in graph_chassis y_serie = np.array(serie[trace.get_name()])[order] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^ IndexError: index 0 is out of bounds for axis 0 with size 0 This commit is adding a new condition to ensure the same-chassis feature is not engaged for a single system. Signed-off-by: Erwan Velu --- graph/hwgraph.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graph/hwgraph.py b/graph/hwgraph.py index 4a5beb4..e4af8bb 100755 --- a/graph/hwgraph.py +++ b/graph/hwgraph.py @@ -195,7 +195,7 @@ def graph_environment(args, output_dir) -> int: if chassis: all_chassis = [t.get_chassis_serial() == chassis for t in args.traces] # if all traces are from the same chassis, let's enable the same_chassis feature - if all_chassis.count(True) == len(args.traces): + if all_chassis.count(True) == len(args.traces) and len(args.traces) > 1: print( f"environment: All traces are from the same chassis ({chassis}), enabling --same-chassis feature" )