def wait_for_nodes(reactor, client, count):
 def got_all_nodes():
  d = client.list_nodes()
  d.addErrback(write_failure)
  def check_node_count(nodes):
   print 'Waiting for nodes, got {} out of {}'.format(len(nodes), count)
   return (len(nodes) >= count)
  d.addCallback(check_node_count)
  return d
 return loop_until(reactor, got_all_nodes, repeat(1, 120))

def wait_for_nodes ( reactor , client , count ) : def got_all_nodes ( ) : d = client . list_nodes ( ) d . addErrback ( write_failure ) def check_node_count ( nodes ) : print 'Waiting for nodes, got {} out of {}' . format ( len ( nodes ) , count ) return ( len ( nodes ) >= count ) d . addCallback ( check_node_count ) return d return loop_until ( reactor , got_all_nodes , repeat ( 1 , 120 ) )
wait until nodes join the cluster .