From 5226daa40bb67ce5d024c0a4283ea78a85c1a99b Mon Sep 17 00:00:00 2001 From: Minh Doan Date: Fri, 6 Jul 2018 17:46:53 -0700 Subject: [PATCH] set write append to False by default --- aws-experiment-launch/create_instances.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/aws-experiment-launch/create_instances.py b/aws-experiment-launch/create_instances.py index b1926d483..e5f412ff6 100644 --- a/aws-experiment-launch/create_instances.py +++ b/aws-experiment-launch/create_instances.py @@ -96,13 +96,14 @@ if __name__ == "__main__": dest='config', default='configuration.txt') parser.add_argument('--instance_output', type=str, dest='instance_output', default='instance_output.txt', help='the file to append or write') + parser.add_argument('--append', dest='append', default=False, help='append to the current instance_output') args = parser.parse_args() config = utils.read_region_config(args.config) region_list = args.regions.split(',') instances_list = args.numInstances.split(',') assert len(region_list) == len(instances_list), "number of regions: %d != number of instances per region: %d" % (len(region_list), len(instances_list)) - with open(args.instance_output, "a") as fout: + with open(args.instance_output, "a" if args.append else "w") as fout: for i in range(len(region_list)): region_number = region_list[i] number_of_instances = instances_list[i]