Permalink
Browse files

cluster: improve wait_for_active_spots

Require active spots to also have an instance_id allocated before
exiting the wait loop. This ensures that the spot requests are 'active'
and also have an instance ID that we can use in the
'wait_for_propagation' call later on. This *might* fix
InstanceDoesNotExist errors related to eventual consistency when using
spot nodes (gh-377).
  • Loading branch information...
jtriley committed Mar 27, 2014
1 parent b31fce7 commit 7101e370d88205cfa7ba95908b90852521d34ca2
Showing with 4 additions and 4 deletions.
  1. +4 −4 starcluster/cluster.py
View
@@ -1377,16 +1377,16 @@ def wait_for_active_spots(self, spots=None):
pbar.maxval = len(spots)
pbar.update(0)
while not pbar.finished:
active_spots = filter(lambda x: x.state == "active", spots)
active_spots = [s for s in spots if s.state == "active" and
s.instance_id]
pbar.maxval = len(spots)
pbar.update(len(active_spots))
if not pbar.finished:
time.sleep(self.refresh_interval)
spots = self.get_spot_requests_or_raise()
else:
self.ec2.wait_for_propagation(
instances=[s.instance_id for s in active_spots])
pbar.reset()
self.ec2.wait_for_propagation(
instances=[s.instance_id for s in spots])
def wait_for_running_instances(self, nodes=None,
kill_pending_after_mins=15):

0 comments on commit 7101e37

Please sign in to comment.