|
@@ -7,10 +7,17 @@ def extract_test_results(res_file_path: str) -> tuple[list[str], list[str]]:
|
|
|
passed = []
|
|
passed = []
|
|
|
failed = []
|
|
failed = []
|
|
|
costs = []
|
|
costs = []
|
|
|
|
|
+ instance_ids = set()
|
|
|
|
|
+ instances = []
|
|
|
with open(res_file_path, 'r') as file:
|
|
with open(res_file_path, 'r') as file:
|
|
|
for line in file:
|
|
for line in file:
|
|
|
data = json.loads(line.strip())
|
|
data = json.loads(line.strip())
|
|
|
success = data['metrics']['success']
|
|
success = data['metrics']['success']
|
|
|
|
|
+ if data['instance_id'] in instance_ids:
|
|
|
|
|
+ print(f'WARNING: Duplicate instance_id found: {data["instance_id"]}')
|
|
|
|
|
+ continue
|
|
|
|
|
+ instance_ids.add(data['instance_id'])
|
|
|
|
|
+ instances.append(data)
|
|
|
if success:
|
|
if success:
|
|
|
passed.append(
|
|
passed.append(
|
|
|
{
|
|
{
|
|
@@ -36,6 +43,12 @@ def extract_test_results(res_file_path: str) -> tuple[list[str], list[str]]:
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|
|
|
costs.append(data['metrics']['accumulated_cost'])
|
|
costs.append(data['metrics']['accumulated_cost'])
|
|
|
|
|
+
|
|
|
|
|
+ # sort by instance_id
|
|
|
|
|
+ instances.sort(key=lambda x: x['instance_id'])
|
|
|
|
|
+ with open(res_file_path, 'w') as file:
|
|
|
|
|
+ for instance in instances:
|
|
|
|
|
+ file.write(json.dumps(instance) + '\n')
|
|
|
return passed, failed, costs
|
|
return passed, failed, costs
|
|
|
|
|
|
|
|
|
|
|