def action(self): print 'Starting glassfish...' logger.info('starting glassfish') try: # Deferred list dlist = [] # For all target domains for target in self.blackboard.hosts.get_hosts('target'): print ' * starting glassfish on target %s' % (target) d = base.launch(self.blackboard.hosts, self.blackboard.client_list, target, 'glassfish_start', wait=False) dlist.append(d) print ' * waiting for glassfish on target %s' % (target) d = base.poll_for_message(self.blackboard.hosts, self.blackboard.client_list, target, 'glassfish_wait', 'Name: domain1 Status: 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 logger.error(e) return False
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)