mirror of
https://github.com/logos-storage/das-research.git
synced 2026-01-04 06:03:10 +00:00
add progress meters to observer
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
parent
037c4cd67a
commit
119777787e
@ -44,6 +44,7 @@ class Observer:
|
|||||||
"""It checks the status of how many expected and arrived samples globally."""
|
"""It checks the status of how many expected and arrived samples globally."""
|
||||||
arrived = 0
|
arrived = 0
|
||||||
expected = 0
|
expected = 0
|
||||||
|
ready = 0
|
||||||
validated = 0
|
validated = 0
|
||||||
for val in validators:
|
for val in validators:
|
||||||
if val.amIproposer == 0:
|
if val.amIproposer == 0:
|
||||||
@ -51,5 +52,16 @@ class Observer:
|
|||||||
arrived += a
|
arrived += a
|
||||||
expected += e
|
expected += e
|
||||||
if a == e:
|
if a == e:
|
||||||
validated += 1
|
ready += 1
|
||||||
return (arrived, expected, validated)
|
validated += val.vpn
|
||||||
|
return (arrived, expected, ready, validated)
|
||||||
|
|
||||||
|
def getProgress(self, validators):
|
||||||
|
arrived, expected, ready, validated = self.checkStatus(validators)
|
||||||
|
missingSamples = expected - arrived
|
||||||
|
sampleProgress = arrived / expected
|
||||||
|
nodeProgress = ready / (len(validators)-1)
|
||||||
|
validatorCnt = sum([v.vpn for v in validators[1:]])
|
||||||
|
validatorProgress = validated / validatorCnt
|
||||||
|
|
||||||
|
return missingSamples, sampleProgress, nodeProgress, validatorProgress
|
||||||
|
|||||||
@ -166,7 +166,7 @@ class Simulator:
|
|||||||
"""It runs the main simulation until the block is available or it gets stucked."""
|
"""It runs the main simulation until the block is available or it gets stucked."""
|
||||||
self.glob.checkRowsColumns(self.validators)
|
self.glob.checkRowsColumns(self.validators)
|
||||||
self.validators[self.proposerID].broadcastBlock()
|
self.validators[self.proposerID].broadcastBlock()
|
||||||
arrived, expected, validated = self.glob.checkStatus(self.validators)
|
arrived, expected, ready, validated = self.glob.checkStatus(self.validators)
|
||||||
missingSamples = expected - arrived
|
missingSamples = expected - arrived
|
||||||
missingVector = []
|
missingVector = []
|
||||||
steps = 0
|
steps = 0
|
||||||
@ -198,12 +198,9 @@ class Simulator:
|
|||||||
for i in range(0,self.shape.numberNodes):
|
for i in range(0,self.shape.numberNodes):
|
||||||
self.validators[i].updateStats()
|
self.validators[i].updateStats()
|
||||||
|
|
||||||
arrived, expected, validated = self.glob.checkStatus(self.validators)
|
missingSamples, sampleProgress, nodeProgress, validatorProgress = self.glob.getProgress(self.validators)
|
||||||
missingSamples = expected - arrived
|
self.logger.debug("step %d, arrived %0.02f %%, ready %0.02f %%, validated %0.02f %%"
|
||||||
missingRate = missingSamples*100/expected
|
% (steps, sampleProgress*100, nodeProgress*100, validatorProgress*100), extra=self.format)
|
||||||
self.logger.debug("step %d, missing %d of %d (%0.02f %%), validated (%0.02f %%)"
|
|
||||||
% (steps, missingSamples, expected, missingRate,
|
|
||||||
validated/(len(self.validators)-1)*100), extra=self.format)
|
|
||||||
if missingSamples == oldMissingSamples:
|
if missingSamples == oldMissingSamples:
|
||||||
self.logger.debug("The block cannot be recovered, failure rate %d!" % self.shape.failureRate, extra=self.format)
|
self.logger.debug("The block cannot be recovered, failure rate %d!" % self.shape.failureRate, extra=self.format)
|
||||||
missingVector.append(missingSamples)
|
missingVector.append(missingSamples)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user