Skip to content

Commit

Permalink
Catching any potetnail json exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
cjnolet committed Nov 14, 2023
1 parent 58a238f commit 7d4cbf8
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 7d4cbf8

Please sign in to comment.