Commit 712f3b25 by Feanil Patel

Merge pull request #1815 from edx/feanil/eventually_consistent

Deal with the fact that the AWS API is eventually consistent.
parents 7b7c3489 c2f5364d
......@@ -595,7 +595,16 @@ def launch_and_configure(ec2_args):
"Waiting for instance {} to reach running status:".format(instance_id)),
status_start = time.time()
for _ in xrange(EC2_RUN_TIMEOUT):
res = ec2.get_all_instances(instance_ids=[instance_id])
try:
res = ec2.get_all_instances(instance_ids=[instance_id])
except EC2ResponseError as e:
if e.code == "InvalidInstanceID.NotFound":
print("Instance not found({}), will try again.".format(
instance_id))
time.sleep(1)
continue
else:
raise(e)
if res[0].instances[0].state == 'running':
status_delta = time.time() - status_start
run_summary.append(('EC2 Launch', status_delta))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment