Skip to content

Instantly share code, notes, and snippets.

@mynnx
Created December 21, 2011 21:32
Show Gist options
  • Save mynnx/1507803 to your computer and use it in GitHub Desktop.
Save mynnx/1507803 to your computer and use it in GitHub Desktop.
rackspace LB API - timing async actions
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