Refactor variable name

This commit is contained in:
Jose Gracia 2024-02-13 14:34:08 +01:00
parent 9c0bfd79f9
commit 1f7dbd80b3

View file

@ -49,19 +49,19 @@ class Power:
idx_ts = 0; idx_node = 1; idx_value = 2
nodes = list(OrderedDict.fromkeys([line[idx_node] for line in data])) # preserves order of nodes
cls = Power(nodes)
power = Power(nodes)
values = {}
for l in data:
ts = l[idx_ts]
if ts not in values:
values[ts] = []
power = l[idx_value]
values[ts].append(power)
value = l[idx_value]
values[ts].append(value)
epochs = values.keys()
for epoch in epochs:
cls.insert_epoch(epoch, values[epoch])
power.insert_epoch(epoch, values[epoch])
# check implicit assumptions: 1) ts/epochs are sorted
e = list(epochs)
@ -77,7 +77,7 @@ class Power:
print("Warning: Unexpected number of nodes ({actual}/{expected})".format(actual=actual, expected=nnodes))
break
return cls
return power
@classmethod
def from_db(cls, db, jobid, interval, hawk_ai):