Created
December 21, 2011 21:32
-
-
Save mynnx/1507803 to your computer and use it in GitHub Desktop.
rackspace LB API - timing async actions
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
test_lb = [b for b in balancers if b.name == 'Mark - T1'][0] | |
updated_balancer = conn.update_balancer(test_lb, | |
name='Mark - T2', | |
protocol='HTTPS', | |
port=84, | |
algorithm=Algorithm.ROUND_ROBIN) | |
import time | |
start = time.time() | |
while updated_balancer.state != State.RUNNING: | |
updated_balancer = conn.get_balancer(updated_balancer.id) | |
print "state is still %d, need %d" % (updated_balancer.state, State.RUNNING) | |
time.sleep(2) | |
delta = time.time() - start | |
print "took %d seconds" % delta |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment