Esempio n. 1
0
def phase_start_glassfish_database(done, client_list):
    """
    Rain has to be started after Glassfish is running! This is important because 
    the Rain Tracks of the SpecJ driver are accessing the Glassfish services. 
    """
    print 'starting glassfish and database...'
    logger.info('starting glassfish and database')
    
    try:
        dlist = []
        
        for target in hosts.get_hosts('target'):
            print '   * starting glassfish on target %s' % (target) 
            d = base.launch(client_list, target, 'glassfish_start', wait=False)
            dlist.append(d)
            
            d = base.poll_for_message(client_list, target, 'glassfish_wait', 'domain1 running')
            dlist.append(d)
        
        # Fill database in parallel
        if INIT_DB:
            for target in hosts.get_hosts('database'):
                print '   * initializing database on target %s' % (target)
                d = base.launch(client_list, target, 'spec_dbload')
                dlist.append(d)
        
        # Wait for all drones to finish and set phase
        dl = defer.DeferredList(dlist)
        
        dl.addCallback(phase_start_rain, client_list)
        # dl.addCallback(finished, client_list)
    except Exception, e:
        print e
        finished(None, client_list)
 def action(self):
     print 'reconfiguring glassfish ...'
     logger.info('reconfiguring glassfish')
     
     try:
         dlist = []
         for target in hosts.get_hosts('target'):
             print '   * configuring glassfish on target %s' % (target)
             
             # mysql_name = target.replace('glassfish', 'mysql')
             mysql_name = 'localhost'
             print '     using mysql name: %s' % (mysql_name)
             drones.prepare_drone('glassfish_configure', 'domain.xml', mysql_server=mysql_name)
             drones.create_drone('glassfish_configure')
             
             d = base.launch(self.blackboard.client_list, target, 'glassfish_configure', wait=True)
             dlist.append(d)
         
         # Wait for all drones to finish and set phase
         dl = defer.DeferredList(dlist)
         d = defer.Deferred()
         dl.addCallback(self.ok, d)
         return d
         
     except Exception, e:
         print e
         return False
Esempio n. 3
0
def phase_configure_glassfish(client_list):
    print 'reconfiguring glassfish ...'
    logger.info('reconfiguring glassfish')
    
    try:
        
        dlist = []
        
        for target in hosts.get_hosts('target'):
            print '   * configuring glassfish on target %s' % (target)
            
            # mysql_name = target.replace('glassfish', 'mysql')
            mysql_name = 'localhost'
            print '     using mysql name: %s' % (mysql_name)
            drones.prepare_drone('glassfish_configure', 'domain.xml', mysql_server=mysql_name)
            drones.create_drone('glassfish_configure')
            
            d = base.launch(client_list, target, 'glassfish_configure', wait=True)
            dlist.append(d)
        
        # Wait for all drones to finish and set phase
        dl = defer.DeferredList(dlist)
        
        dl.addCallback(phase_start_glassfish_database, client_list)
        # dl.addCallback(finished, client_list)
        
    except Exception, e:
        print e
        finished(None, client_list)
 def action(self):
     print 'starting rain DRIVER_NODES...'
     logger.info('starting rain DRIVER_NODES')
     
     # Dump profile
     profiles.dump(logger)
     
     dlist = []
 
     targets = hosts.get_hosts('target')
     target_count = len(targets)
     
     DRIVER_NODES = hosts.get_hosts('load')
     driver_count = len(DRIVER_NODES)
     
     targets_per_driver = int(math.ceil(float(target_count) / float(driver_count)))
     
     for i in range(0, driver_count):
         driver = DRIVER_NODES[i]
         
         # Build targets for configuration
         config_targets = []
         for target in targets[i * targets_per_driver : (i + 1) * targets_per_driver]:
             config_target = {}
             config_target['target'] = target
             
             # Important: Load the USER workload profile
             config_target['profile'] = domains.user_profile_by_name(target)
             config_targets.append(config_target)
 
         print config_targets
 
         # Configure drone
         drones.prepare_drone('rain_start', 'rain.config.specj.json', targets=config_targets)
         drones.create_drone('rain_start')
         
         # Launch this drone
         d = base.wait_for_message(self.blackboard.client_list, driver, 'rain_start', 'Waiting for start signal...', '/opt/rain/rain.log')
         dlist.append(d)
     
     
     # Wait for all load DRIVER_NODES to start
     d = defer.Deferred()
     dl = defer.DeferredList(dlist)
     dl.addCallback(self.ok, d)
     return d
Esempio n. 5
0
def shutdown_glassfish_rain(client_list, ret=None):
    print "stopping glassfish and rain DRIVER_NODES..."
    logger.info('stopping glassfish and rain DRIVER_NODES')
    
    dlist = []
    
    for target in hosts.get_hosts('target'):
        print 'stopping glassfish on target %s' % (target) 
        d = base.launch(client_list, target, 'glassfish_stop')
        dlist.append(d)
    
    for target in hosts.get_hosts('load'):
        print 'stopping rain on target %s' % (target)
        d = base.launch(client_list, target, 'rain_stop')
        dlist.append(d)
    
    dl = defer.DeferredList(dlist)
    dl.addCallback(finished_end, client_list)
 def action(self):
     print "stopping glassfish and rain DRIVER_NODES..."
     logger.info('stopping glassfish and rain DRIVER_NODES')
     
     dlist = []
     
     print('stopping glassfish on targets: '),
     for target in hosts.get_hosts('target'):
         print target 
         d = base.launch(self.blackboard.client_list, target, 'glassfish_stop')
         dlist.append(d)
     print ''
     
     print('stopping rain on targets: '),
     for target in hosts.get_hosts('load'):
         print target
         d = base.launch(self.blackboard.client_list, target, 'rain_stop')
         dlist.append(d)
     print ''
     
     dl = defer.DeferredList(dlist)
     d = defer.Deferred()
     dl.addCallback(self.ok, d)
     return d
Esempio n. 7
0
def trigger_rain_benchmark(ret, client_list):
    print 'connecting with rain DRIVER_NODES...'
    logger.info('connecting with rain DRIVER_NODES')
    
    dlist = []
    for driver in hosts.get_hosts('load'):
        print '   * connecting %s' % (driver)
        creator = ClientCreator(reactor,
                              TTwisted.ThriftClientProtocol,
                              RainService.Client,
                              TBinaryProtocol.TBinaryProtocolFactory(),
                              ).connectTCP(driver, 7852, timeout=120)
        dlist.append(creator)
        
    d = defer.DeferredList(dlist)                  
    d.addCallback(rain_connected, client_list)
    d.addErrback(rain_connection_failed, client_list)
 def action(self):
     print 'starting database...'
     logger.info('starting database')
     
     try:
         dlist = []
         for target in hosts.get_hosts('database'):
             print '   * initializing database on target %s' % (target)
             d = base.launch(self.blackboard.client_list, target, 'spec_dbload')
             dlist.append(d)
         
         # Wait for all drones to finish and set phase
         d = defer.Deferred()
         dl = defer.DeferredList(dlist)
         dl.addCallback(self.ok, d)
         return d
         
     except Exception, e:
         print e
         return False
 def action(self, d=None):
     print 'connecting with rain DRIVER_NODES...'
     logger.info('connecting with rain DRIVER_NODES')
     
     dlist = []
     for driver in hosts.get_hosts('load'):
         print '   * connecting %s' % (driver)
         creator = ClientCreator(reactor,
                               TTwisted.ThriftClientProtocol,
                               RainService.Client,
                               TBinaryProtocol.TBinaryProtocolFactory(),
                               ).connectTCP(driver, 7852, timeout=120)
         dlist.append(creator)
       
     if d == None:
         d = defer.Deferred()  
     dl = defer.DeferredList(dlist)                  
     dl.addCallback(self.ok, d)
     dl.addErrback(self.err, d)
     return d
Esempio n. 10
0
 def action(self):
     print 'starting glassfish...'
     logger.info('starting glassfish')
     
     try:
         dlist = []
         
         for target in hosts.get_hosts('target'):
             print '   * starting glassfish on target %s' % (target) 
             d = base.launch(self.blackboard.client_list, target, 'glassfish_start', wait=False)
             dlist.append(d)
             
             d = base.poll_for_message(self.blackboard.client_list, target, 'glassfish_wait', 'domain1 running')
             dlist.append(d)
         
         # Wait for all drones to finish and set phase
         d = defer.Deferred()
         dl = defer.DeferredList(dlist)
         dl.addCallback(self.ok, d)
         return d
         
     except Exception, e:
         print e
         return False