From 718a4385bc1955d4242b211f99ccc1b8ddf4bc47 Mon Sep 17 00:00:00 2001 From: Minh Doan Date: Fri, 6 Jul 2018 00:27:45 -0700 Subject: [PATCH] standalone program collect_public_ips --- aws-experiment-launch/collect_public_ips.py | 22 +++++++++++++++++++++ aws-experiment-launch/raw_ip.txt | 5 +++++ aws-experiment-launch/utils/__init__.py | 0 aws-experiment-launch/utils/utils.py | 9 +++++---- 4 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 aws-experiment-launch/collect_public_ips.py create mode 100644 aws-experiment-launch/raw_ip.txt create mode 100644 aws-experiment-launch/utils/__init__.py diff --git a/aws-experiment-launch/collect_public_ips.py b/aws-experiment-launch/collect_public_ips.py new file mode 100644 index 000000000..58b9ee04a --- /dev/null +++ b/aws-experiment-launch/collect_public_ips.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") + diff --git a/aws-experiment-launch/raw_ip.txt b/aws-experiment-launch/raw_ip.txt new file mode 100644 index 000000000..e26548d6d --- /dev/null +++ b/aws-experiment-launch/raw_ip.txt @@ -0,0 +1,5 @@ +34.214.244.37 +34.220.54.177 +54.201.44.15 +54.202.250.175 +34.217.95.116 diff --git a/aws-experiment-launch/utils/__init__.py b/aws-experiment-launch/utils/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/aws-experiment-launch/utils/utils.py b/aws-experiment-launch/utils/utils.py index 5bf70f225..459ca9a90 100644 --- a/aws-experiment-launch/utils/utils.py +++ b/aws-experiment-launch/utils/utils.py @@ -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)) validator_id = validator_id + 1 -if __name__ == "__main__": - ip_list = collect_public_ips('4', "4-NODE-23-36-01-2018-07-05", "configuration.txt") - print ip_list - generate_distribution_config(2, 1, ip_list, "config_test.txt") +# used for testing only. +# if __name__ == "__main__": +# ip_list = collect_public_ips('4', "4-NODE-23-36-01-2018-07-05", "configuration.txt") +# print ip_list +# generate_distribution_config(2, 1, ip_list, "config_test.txt")