in benchmark/benchmark/remote.py [0:0]
def _config(self, hosts, node_parameters, bench_parameters):
Print.info('Generating configuration files...')
# Cleanup all local configuration files.
cmd = CommandMaker.cleanup()
subprocess.run([cmd], shell=True, stderr=subprocess.DEVNULL)
# Recompile the latest code.
cmd = CommandMaker.compile().split()
subprocess.run(cmd, check=True, cwd=PathMaker.node_crate_path())
# Create alias for the client and nodes binary.
cmd = CommandMaker.alias_binaries(PathMaker.binary_path())
subprocess.run([cmd], shell=True)
# Generate configuration files.
keys = []
key_files = [PathMaker.key_file(i) for i in range(len(hosts))]
for filename in key_files:
cmd = CommandMaker.generate_key(filename).split()
subprocess.run(cmd, check=True)
keys += [Key.from_file(filename)]
names = [x.name for x in keys]
if bench_parameters.collocate:
workers = bench_parameters.workers
addresses = OrderedDict(
(x, [y] * (workers + 1)) for x, y in zip(names, hosts)
)
else:
addresses = OrderedDict(
(x, y) for x, y in zip(names, hosts)
)
committee = Committee(addresses, self.settings.base_port)
committee.print(PathMaker.committee_file())
node_parameters.print(PathMaker.parameters_file())
# Cleanup all nodes and upload configuration files.
names = names[:len(names)-bench_parameters.faults]
progress = progress_bar(names, prefix='Uploading config files:')
for i, name in enumerate(progress):
for ip in committee.ips(name):
c = Connection(ip, user='ubuntu', connect_kwargs=self.connect)
c.run(f'{CommandMaker.cleanup()} || true', hide=True)
c.put(PathMaker.committee_file(), '.')
c.put(PathMaker.key_file(i), '.')
c.put(PathMaker.parameters_file(), '.')
return committee