import os import json import shutil import copy def process_json_file(file_path): fr = open(file_path, 'r') json_data = json.load(fr) entries = json_data["count"] for i in range(entries): bs = json_data["list"][i]["task"]["batching"]["batch_size"] del json_data["list"][i]["task"]["batching"] del json_data["list"][i]["task"]["iterations"] json_data["list"][i]["task"]["batch_size"] = bs json_data["repetitions"] = 10 with open(file_path, 'w') as f: json.dump(json_data, f, indent=2) def process_files_in_folder(folder_path): for filename in os.listdir(folder_path): file_path = os.path.join(folder_path, filename) if os.path.isfile(file_path) and filename.endswith('.json'): process_json_file(file_path) if __name__ == "__main__": folder_path = "./peak-perf-allnodes-cpu/" process_files_in_folder(folder_path)