in benchmark/benchmark/config.py [0:0]
def __init__(self, json):
try:
faults = json['faults']
faults = faults if isinstance(faults, list) else [faults]
self.faults = [int(x) for x in faults] if faults else [0]
nodes = json['nodes']
nodes = nodes if isinstance(nodes, list) else [nodes]
if not nodes:
raise ConfigError('Missing number of nodes')
self.nodes = [int(x) for x in nodes]
workers = json['workers']
workers = workers if isinstance(workers, list) else [workers]
if not workers:
raise ConfigError('Missing number of workers')
self.workers = [int(x) for x in workers]
if 'collocate' in json:
self.collocate = bool(json['collocate'])
else:
self.collocate = True
self.tx_size = int(json['tx_size'])
max_lat = json['max_latency']
max_lat = max_lat if isinstance(max_lat, list) else [max_lat]
if not max_lat:
raise ConfigError('Missing max latency')
self.max_latency = [int(x) for x in max_lat]
except KeyError as e:
raise ConfigError(f'Malformed bench parameters: missing key {e}')
except ValueError:
raise ConfigError('Invalid parameters type')
if len(self.nodes) > 1 and len(self.workers) > 1:
raise ConfigError(
'Either the "nodes" or the "workers can be a list (not both)'
)