modify the order of distribution: validator, leader, client

pull/37/head
Minh Doan 6 years ago
parent a53be326ef
commit 66c2a7d6a2
  1. 11
      aws-experiment-launch/utils/utils.py

@ -105,17 +105,18 @@ def generate_distribution_config(shard_number, client_number, ip_list, distribut
# Create ip for clients. # Create ip for clients.
client_id, leader_id, validator_id = 0, 0, 0 client_id, leader_id, validator_id = 0, 0, 0
validator_number = len(ip_list) - client_number - shard_number
with open(distribution_config, "w") as fout: with open(distribution_config, "w") as fout:
for i in range(len(ip_list)): for i in range(len(ip_list)):
if client_id < client_number: if validator_id < validator_number:
fout.write("%s 9000 client %d\n" % (ip_list[i], client_id % shard_number)) fout.write("%s 9000 validator %d\n" % (ip_list[i], validator_id % shard_number))
client_id = client_id + 1 validator_id = validator_id + 1
elif leader_id < shard_number: elif leader_id < shard_number:
fout.write("%s 9000 leader %d\n" % (ip_list[i], leader_id)) fout.write("%s 9000 leader %d\n" % (ip_list[i], leader_id))
leader_id = leader_id + 1 leader_id = leader_id + 1
else: else:
fout.write("%s 9000 validator %d\n" % (ip_list[i], validator_id % shard_number)) fout.write("%s 9000 client %d\n" % (ip_list[i], client_id % shard_number))
validator_id = validator_id + 1 client_id = client_id + 1
def get_availability_zones(ec2_client): def get_availability_zones(ec2_client):
response = ec2_client.describe_availability_zones() response = ec2_client.describe_availability_zones()

Loading…
Cancel
Save