"docs/vscode:/vscode.git/clone" did not exist on "1b6cb920e6ebcac57154e6154578c39d4892a16c"
Unverified Commit 0678b522 authored by Huy Do's avatar Huy Do Committed by GitHub
Browse files

Handle non-serializable objects when dumping benchmark results (#19114)

parent 25b918ee
...@@ -11,6 +11,8 @@ repos: ...@@ -11,6 +11,8 @@ repos:
hooks: hooks:
- id: yapf - id: yapf
args: [--in-place, --verbose] args: [--in-place, --verbose]
# Keep the same list from yapfignore here to avoid yapf failing without any inputs
exclude: '(.buildkite|benchmarks|build|examples)/.*'
- repo: https://github.com/astral-sh/ruff-pre-commit - repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.7 rev: v0.11.7
hooks: hooks:
......
...@@ -66,4 +66,9 @@ class InfEncoder(json.JSONEncoder): ...@@ -66,4 +66,9 @@ class InfEncoder(json.JSONEncoder):
def write_to_json(filename: str, records: list) -> None: def write_to_json(filename: str, records: list) -> None:
with open(filename, "w") as f: with open(filename, "w") as f:
json.dump(records, f, cls=InfEncoder) json.dump(
records,
f,
cls=InfEncoder,
default=lambda o: f"<{type(o).__name__} object is not JSON serializable>",
)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment