Browse files

awsutils: fix 'placement group DNE' errors

In some cases fetching the placement group object immediately after
it's been created returns a DNE error due to a race condition in the EC2
API back-end. Updated EasyEC2.create_placement_group to avoid this issue
by waiting until the new placement group can successfully be refetched
via EasyEC2.get_placement_group_or_none before returning the new
placement group to the caller.

closes gh-161
  • Loading branch information...
1 parent 02bfecc commit 7919a858b645cc4e43b649ddbb19f1194a596425 @jtriley committed Dec 29, 2012
Showing with 6 additions and 1 deletion.
  1. +6 −1 starcluster/
7 starcluster/
@@ -280,7 +280,12 @@ def create_placement_group(self, name):
(name, success))
raise exception.AWSError(
"failed to create placement group '%s'" % name)
- return self.get_placement_group(name)
+ pg = self.get_placement_group_or_none(name)
+ while not pg:
+"Waiting for placement group %s..." % name)
+ time.sleep(3)
+ pg = self.get_placement_group_or_none(name)
+ return pg
def get_placement_groups(self, filters=None):
return self.conn.get_all_placement_groups(filters=filters)

0 comments on commit 7919a85

Please sign in to comment.