Created
July 29, 2012 17:49
-
-
Save rtomaszewski/3200566 to your computer and use it in GitHub Desktop.
Be aware of the cloud API limitations when creating cloud servers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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