def start_commands_on_host(self, _cohs): """ Starts selected commands on host. @param cmd_ids: list of commands ids @type cmd_ids: list """ scheduler = self.config.name cmd_ids = get_commands(_cohs) cohs = [] for cmd_id in cmd_ids : cohs.extend(get_cohs(cmd_id, scheduler)) self.statistics.watchdog_schedule(cmd_id) switch_commands_to_start(cohs) active_circuits = [c for c in self._circuits if c.id in cohs] active_cohs = [c.id for c in active_circuits] new_cohs = [id for id in cohs if id not in active_cohs and not id in self.stopped_track] self.logger.info("Starting %s circuits" % len(new_cohs)) for circuit in active_circuits : self.logger.info("Circuit #%s: start" % circuit.id) # set the next_launch_date for now circuit.cohq.coh.reSchedule(0, False) circuit.cohq.cmd.refresh() return True
def start_commands(self, cmds): self.logger.info("Prepare %d commands to START..." % len(cmds)) scheduler = self.config.name if len(cmds) > 0: for cmd_id in cmds: if is_command_in_valid_time(cmd_id): cohs = get_cohs(cmd_id, scheduler) self.start_commands_on_host(cohs) return True