Minor fixes

This commit is contained in:
Alban Bronisz 2021-04-07 19:39:38 +02:00
parent 7b9936334c
commit c36429f3df

View File

@ -59,12 +59,13 @@ def load_data(stats_fn: str):
for t_i, stat in enumerate(data): for t_i, stat in enumerate(data):
for field in stat: for field in stat:
if field == "date": # date if field == "date": # date
date_ = stat[field].replace("+01:00", "+0000") date_ = stat[field].replace("+01:00", "+0000").replace("+02:00", "+0200")
data_dict[field][t_i] = datetime.strptime(date_, "%Y-%m-%dT%H:%M:%S%z") data_dict[field][t_i] = datetime.strptime(date_, "%Y-%m-%dT%H:%M:%S%z")
else: # float else: # float
value = stat[field].split(" ")[0] value = stat[field].split(" ")[0]
value = value.replace("MiB", "e3") value = value.replace("MiB", "e3")
value = value.replace("GiB", "e6") value = value.replace("GiB", "e6")
value = value.replace("B", "")
data_dict[name_from_field(field)][t_i] += float(value) / 1000 # values are in MiB data_dict[name_from_field(field)][t_i] += float(value) / 1000 # values are in MiB
return data_dict return data_dict