From 3fb2fc668dee8d173782e11cc6d3e3bd7ae54528 Mon Sep 17 00:00:00 2001 From: David Yastremsky <58150256+dyastremsky@users.noreply.github.com> Date: Thu, 11 Jul 2024 14:29:38 -0700 Subject: [PATCH] Reuse code block Co-authored-by: Hyunjae Woo <107147848+nv-hwoo@users.noreply.github.com> --- src/c++/perf_analyzer/genai-perf/genai_perf/utils.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/c++/perf_analyzer/genai-perf/genai_perf/utils.py b/src/c++/perf_analyzer/genai-perf/genai_perf/utils.py index ee30cb817..e5ced7156 100644 --- a/src/c++/perf_analyzer/genai-perf/genai_perf/utils.py +++ b/src/c++/perf_analyzer/genai-perf/genai_perf/utils.py @@ -54,12 +54,7 @@ def load_yaml(filepath: Path) -> Dict[str, Any]: def load_json(filepath: Path) -> Dict[str, Any]: with open(str(filepath), encoding="utf-8", errors="ignore") as f: content = f.read() - try: - return json.loads(content) - except json.JSONDecodeError: - snippet = content[:200] + ("..." if len(content) > 200 else "") - logger.error("Failed to parse JSON string: '%s'", snippet) - raise + load_json_str(content) def load_json_str(json_str: str) -> Dict[str, Any]: