Refactor variable name
This commit is contained in:
parent
9c0bfd79f9
commit
1f7dbd80b3
1 changed files with 5 additions and 5 deletions
|
@ -49,19 +49,19 @@ class Power:
|
||||||
|
|
||||||
idx_ts = 0; idx_node = 1; idx_value = 2
|
idx_ts = 0; idx_node = 1; idx_value = 2
|
||||||
nodes = list(OrderedDict.fromkeys([line[idx_node] for line in data])) # preserves order of nodes
|
nodes = list(OrderedDict.fromkeys([line[idx_node] for line in data])) # preserves order of nodes
|
||||||
cls = Power(nodes)
|
power = Power(nodes)
|
||||||
|
|
||||||
values = {}
|
values = {}
|
||||||
for l in data:
|
for l in data:
|
||||||
ts = l[idx_ts]
|
ts = l[idx_ts]
|
||||||
if ts not in values:
|
if ts not in values:
|
||||||
values[ts] = []
|
values[ts] = []
|
||||||
power = l[idx_value]
|
value = l[idx_value]
|
||||||
values[ts].append(power)
|
values[ts].append(value)
|
||||||
|
|
||||||
epochs = values.keys()
|
epochs = values.keys()
|
||||||
for epoch in epochs:
|
for epoch in epochs:
|
||||||
cls.insert_epoch(epoch, values[epoch])
|
power.insert_epoch(epoch, values[epoch])
|
||||||
|
|
||||||
# check implicit assumptions: 1) ts/epochs are sorted
|
# check implicit assumptions: 1) ts/epochs are sorted
|
||||||
e = list(epochs)
|
e = list(epochs)
|
||||||
|
@ -77,7 +77,7 @@ class Power:
|
||||||
print("Warning: Unexpected number of nodes ({actual}/{expected})".format(actual=actual, expected=nnodes))
|
print("Warning: Unexpected number of nodes ({actual}/{expected})".format(actual=actual, expected=nnodes))
|
||||||
break
|
break
|
||||||
|
|
||||||
return cls
|
return power
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_db(cls, db, jobid, interval, hawk_ai):
|
def from_db(cls, db, jobid, interval, hawk_ai):
|
||||||
|
|
Loading…
Reference in a new issue