Ejemplo n.º 1
0
def allocate_domains():
    # Create drones
    drones.build_all_drones()
    
    # Setup initial allocation
    if start:
        import allocate_domains
        allocate_domains.allocate_domains(True, controller)
    
    # Add host
    for i in xrange(0, 18):
        hosts.add_host('target%i' % i, 'target')
        hosts.add_host('target%i' % i, 'database')
    
    hosts.add_host('load0', 'load')
    hosts.add_host('load1', 'load')
    
    # Connect with all drone relays
    hosts_map = hosts.get_hosts_list()
    dlist = base.connect(hosts_map)
        
    # Wait for all connections
    wait = defer.DeferredList(dlist)
    wait.addErrback(errback)
    
    # Decide what to do after connection setup
    if start:
        print 'starting system ...'
        wait.addCallback(start_phase)
    else:
        print 'stopping system ...'
        wait.addCallback(stop_phase)
    
    # Start the Twisted reactor
    reactor.run()
Ejemplo n.º 2
0
 def connect(self, d):
     # Connect with all drone relays
     hosts_map = self.blackboard.hosts.get_hosts_list()
     dlist = base.connect(hosts_map)
         
     # Wait for all connections
     logger.info('connecting with relay services')
     wait = defer.DeferredList(dlist, fireOnOneErrback=True)
     wait.addCallback(self.connected, d)
     wait.addErrback(self.error_retry, d)
Ejemplo n.º 3
0
 def action(self):
     # Create drones
     drones.build_all_drones()
     
     # Add host
     for i in xrange(0, 18):
         hosts.add_host('target%i' % i, 'target')
         hosts.add_host('target%i' % i, 'database')
     
     hosts.add_host('load0', 'load')
     hosts.add_host('load1', 'load')
     
     # Connect with all drone relays
     hosts_map = hosts.get_hosts_list()
     dlist = base.connect(hosts_map)
         
     # Wait for all connections
     wait = defer.DeferredList(dlist)
     d = defer.Deferred()
     wait.addCallback(self.start_phase, d)
     return d