diff --git a/aws-experiment-launch/create_and_deploy.py b/aws-experiment-launch/create_and_deploy.py index 820db849b..3ede4c0b5 100644 --- a/aws-experiment-launch/create_and_deploy.py +++ b/aws-experiment-launch/create_and_deploy.py @@ -87,17 +87,22 @@ def create_instances(config, ec2_client, region_number, number_of_instances): }, ] }, - ] + ], + # We can also request spot instances this way but this way will block the + # process until spot requests are fulfilled, otherwise it will throw exception + # after 4 failed re-try. + # InstanceMarketOptions= { + # 'MarketType': 'spot', + # 'SpotOptions': { + # 'SpotInstanceType': 'one-time', + # 'BlockDurationMinutes': 60, + # } + # } ) return NODE_NAME def request_spots(config, ec2_client, region_number, number_of_instances): - placement_group = region_number + "-" + PLACEMENT_GROUP - response = ec2_client.create_placement_group( - GroupName=placement_group, - Strategy='spread' - ) response = ec2_client.request_spot_instances( # DryRun=True, BlockDurationMinutes=60, @@ -112,8 +117,7 @@ def request_spots(config, ec2_client, region_number, number_of_instances): 'InstanceType': INSTANCE_TYPE, 'KeyName': config[region_number][REGION_KEY], 'Placement': { - 'AvailabilityZone': get_one_availability_zone(ec2_client), - 'GroupName': placement_group + 'AvailabilityZone': get_one_availability_zone(ec2_client) } } )