Skip to content

Commit

Permalink
Reuse code block
Browse files Browse the repository at this point in the history
Co-authored-by: Hyunjae Woo <[email protected]>
  • Loading branch information
dyastremsky and nv-hwoo authored Jul 11, 2024
1 parent 43010ca commit 3fb2fc6
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/c++/perf_analyzer/genai-perf/genai_perf/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down

0 comments on commit 3fb2fc6

Please sign in to comment.