fix: add created_at field to results

This commit is contained in:
Hugo Larcher 2024-10-02 13:55:01 +02:00
parent 2980720af4
commit d30266dc3c
No known key found for this signature in database
GPG Key ID: 3DAF63124699CA2B
1 changed files with 4 additions and 0 deletions

View File

@ -1,3 +1,4 @@
import datetime
import json import json
import os import os
import traceback import traceback
@ -141,6 +142,8 @@ def get_num_gpus() -> int:
def build_df(model: str, data_files: dict[str, str]) -> pd.DataFrame: def build_df(model: str, data_files: dict[str, str]) -> pd.DataFrame:
df = pd.DataFrame() df = pd.DataFrame()
now = datetime.datetime.now(datetime.timezone.utc)
created_at = now.isoformat() # '2024-10-02T11:53:17.026215+00:00'
# Load the results # Load the results
for key, filename in data_files.items(): for key, filename in data_files.items():
with open(filename, 'r') as f: with open(filename, 'r') as f:
@ -153,6 +156,7 @@ def build_df(model: str, data_files: dict[str, str]) -> pd.DataFrame:
entry['tp'] = data['config']['meta']['tp'] entry['tp'] = data['config']['meta']['tp']
entry['version'] = data['config']['meta']['version'] entry['version'] = data['config']['meta']['version']
entry['model'] = model entry['model'] = model
entry['created_at'] = created_at
del entry['config'] del entry['config']
df = pd.concat([df, pd.DataFrame(entry, index=[0])]) df = pd.concat([df, pd.DataFrame(entry, index=[0])])
return df return df