standalone program collect_public_ips

pull/37/head
Minh Doan 6 years ago
parent e35df38fd4
commit 718a4385bc
  1. 22
      aws-experiment-launch/collect_public_ips.py
  2. 5
      aws-experiment-launch/raw_ip.txt
  3. 0
      aws-experiment-launch/utils/__init__.py
  4. 9
      aws-experiment-launch/utils/utils.py

@ -0,0 +1,22 @@
import argparse
import sys
from utils import utils
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='This script helps you to collect public ips')
parser.add_argument('--region', type=str, dest='region_number',
default="4", help="region number")
parser.add_argument('--node_name_tag', type=str,
dest='node_name_tag', default='4-NODE-23-36-01-2018-07-05')
parser.add_argument('--region_config', type=str,
dest='region_config', default='configuration.txt')
parser.add_argument('--file_output', type=str,
dest='file_output', default='raw_ip.txt')
args = parser.parse_args()
ip_list = utils.collect_public_ips(args.region_number, args.node_name_tag, args.region_config)
with open(args.file_output, "w") as fout:
for ip in ip_list:
fout.write(ip + "\n")

@ -0,0 +1,5 @@
34.214.244.37
34.220.54.177
54.201.44.15
54.202.250.175
34.217.95.116

@ -57,7 +57,8 @@ def generate_distribution_config(shard_num, client_num, ip_list, config_filename
fout.write("%s 9000 validator %d\n" % (ip_list[i], validator_id % shard_num)) fout.write("%s 9000 validator %d\n" % (ip_list[i], validator_id % shard_num))
validator_id = validator_id + 1 validator_id = validator_id + 1
if __name__ == "__main__": # used for testing only.
ip_list = collect_public_ips('4', "4-NODE-23-36-01-2018-07-05", "configuration.txt") # if __name__ == "__main__":
print ip_list # ip_list = collect_public_ips('4', "4-NODE-23-36-01-2018-07-05", "configuration.txt")
generate_distribution_config(2, 1, ip_list, "config_test.txt") # print ip_list
# generate_distribution_config(2, 1, ip_list, "config_test.txt")

Loading…
Cancel
Save