in benchmark/benchmark/remote.py [0:0]
def _run_single(self, rate, committee, bench_parameters, debug=False):
faults = bench_parameters.faults
# Kill any potentially unfinished run and delete logs.
hosts = committee.ips()
self.kill(hosts=hosts, delete_logs=True)
# Run the clients (they will wait for the nodes to be ready).
# Filter all faulty nodes from the client addresses (or they will wait
# for the faulty nodes to be online).
Print.info('Booting clients...')
workers_addresses = committee.workers_addresses(faults)
rate_share = ceil(rate / committee.workers())
for i, addresses in enumerate(workers_addresses):
for (id, address) in addresses:
host = Committee.ip(address)
cmd = CommandMaker.run_client(
address,
bench_parameters.tx_size,
rate_share,
[x for y in workers_addresses for _, x in y]
)
log_file = PathMaker.client_log_file(i, id)
self._background_run(host, cmd, log_file)
# Run the primaries (except the faulty ones).
Print.info('Booting primaries...')
for i, address in enumerate(committee.primary_addresses(faults)):
host = Committee.ip(address)
cmd = CommandMaker.run_primary(
PathMaker.key_file(i),
PathMaker.committee_file(),
PathMaker.db_path(i),
PathMaker.parameters_file(),
debug=debug
)
log_file = PathMaker.primary_log_file(i)
self._background_run(host, cmd, log_file)
# Run the workers (except the faulty ones).
Print.info('Booting workers...')
for i, addresses in enumerate(workers_addresses):
for (id, address) in addresses:
host = Committee.ip(address)
cmd = CommandMaker.run_worker(
PathMaker.key_file(i),
PathMaker.committee_file(),
PathMaker.db_path(i, id),
PathMaker.parameters_file(),
id, # The worker's id.
debug=debug
)
log_file = PathMaker.worker_log_file(i, id)
self._background_run(host, cmd, log_file)
# Wait for all transactions to be processed.
duration = bench_parameters.duration
for _ in progress_bar(range(20), prefix=f'Running benchmark ({duration} sec):'):
sleep(ceil(duration / 20))
self.kill(hosts=hosts, delete_logs=False)