Skip to content

Instantly share code, notes, and snippets.

@rtomaszewski
Created July 29, 2012 17:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rtomaszewski/3200566 to your computer and use it in GitHub Desktop.
Save rtomaszewski/3200566 to your computer and use it in GitHub Desktop.
Be aware of the cloud API limitations when creating cloud servers
# example code that creates cloud server and try not to hit the cloud API climits
cs_count=13 # number of cs to build
build_nr=1
delayed_10s=False
while build_nr <= cs_count :
if 0==build_nr % 11 and not delayed_10s:
time.sleep(60+10)
try:
server = self.cs_create(build_nr, sample_nr)
delayed_10s=False
except exceptions.OverLimit:
time.sleep(10)
delayed_10s=True
continue
cs_records.append(cs_record)
build_nr+=1
@rtomaszewski
Copy link
Author

Written for this blog entry:

How to avoid Rackspace cloud API limits when creating cloud servers (cloudservers.exceptions.OverLimit)
http://rtomaszewski.blogspot.co.uk/2012/07/how-to-avoid-rackspace-cloud-api-limits.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment