Skip to content

Commit

Permalink
Skipping bad json parse (#1990)
Browse files Browse the repository at this point in the history
Authors:
  - Corey J. Nolet (https://github.com/cjnolet)

Approvers:
  - Divye Gala (https://github.com/divyegala)

URL: #1990
  • Loading branch information
cjnolet authored Nov 14, 2023
1 parent e6fde8c commit e86e75f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions python/raft-ann-bench/src/raft-ann-bench/data_export/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,15 @@ def read_file(dataset, dataset_path, method):
for file in os.listdir(dir):
if file.endswith(".json"):
with open(os.path.join(dir, file), "r") as f:
data = json.load(f)
df = pd.DataFrame(data["benchmarks"])
yield (os.path.join(dir, file), file.split("-")[0], df)
try:
data = json.load(f)
df = pd.DataFrame(data["benchmarks"])
yield os.path.join(dir, file), file.split("-")[0], df
except Exception as e:
print(
"An error occurred processing file %s (%s). "
"Skipping..." % (file, e)
)


def convert_json_to_csv_build(dataset, dataset_path):
Expand Down

0 comments on commit e86e75f

Please sign in to comment.