def execute(self): # Dump profiles profiles.dump(logger) # Dump nodes configuration nodes.dump(logger) # Dump mapping domains.dump(logger)
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