mirror of
https://github.com/codex-storage/das-research.git
synced 2025-02-24 00:38:26 +00:00
consider shuffleLines in segmentShuffleScheduler
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
parent
a1a8a4282d
commit
186d430ad1
@ -10,13 +10,16 @@ from bitarray.util import zeros
|
||||
from collections import deque
|
||||
|
||||
|
||||
def shuffled(lis):
|
||||
def shuffled(lis, shuffle=True):
|
||||
''' Generator yielding list in shuffled order
|
||||
'''
|
||||
# based on https://stackoverflow.com/a/60342323
|
||||
for index in random.sample(range(len(lis)), len(lis)):
|
||||
yield lis[index]
|
||||
|
||||
if shuffle:
|
||||
for index in random.sample(range(len(lis)), len(lis)):
|
||||
yield lis[index]
|
||||
else:
|
||||
for v in lis:
|
||||
yield v
|
||||
def shuffledDict(d, shuffle=True):
|
||||
''' Generator yielding dictionary in shuffled order
|
||||
|
||||
@ -479,7 +482,7 @@ class Validator:
|
||||
if not self.segmentsToSend:
|
||||
break
|
||||
else:
|
||||
self.segmentShuffleGen = shuffled(self.segmentsToSend)
|
||||
self.segmentShuffleGen = shuffled(self.segmentsToSend, self.shuffleLines)
|
||||
|
||||
if self.dumbRandomScheduler:
|
||||
# dumb random scheduler picking segments at random and trying to send it
|
||||
|
Loading…
x
Reference in New Issue
Block a user