Esempio n. 1
0
    def stop_commands(self, cohs=[]):
        """
        Stops all or selected circuits.

        @param cohs: list of commands_on_host
        @type cohs: list
        """
        cmd_ids = get_commands(cohs)
        active_circuits = [c for c in self._circuits if c.id in cohs]

        active_cohs = [c.id for c in active_circuits]

        self.logger.info("Prepare %d circuits to STOP ..." % len(active_cohs))
        for cmd_id in cmd_ids:
            # final statistics calculate
            self.statistics.watchdog_schedule(cmd_id)

        self.stopped_track.add(active_cohs)

        for circuit in active_circuits:
            circuit.cohq.coh.refresh()
            circuit.cohq.cmd.refresh()
            circuit.release()

        return True
Esempio n. 2
0
    def stop_commands(self, cohs=[]):
        """
        Stops all or selected circuits.

        @param cohs: list of commands_on_host
        @type cohs: list
        """
        # Mutable list cohs used as default argument to a method or function
        cmd_ids = get_commands(cohs)
        active_circuits = [c for c in self._circuits if c.id in cohs]

        active_cohs = [c.id for c in active_circuits]

        self.logger.info("Prepare %d circuits to STOP ..." % len(active_cohs))
        for cmd_id in cmd_ids:
            # final statistics calculate
            self.statistics.watchdog_schedule(cmd_id)

        self.stopped_track.add(active_cohs)

        for circuit in active_circuits:
            circuit.cohq.coh.refresh()
            circuit.cohq.cmd.refresh()
            circuit.release()

        return True
Esempio n. 3
0
    def start_commands_on_host(self, cohs):
        """
        Starts selected commands on host.

        @param cmd_ids: list of commands ids
        @type cmd_ids: list
        """
        cmd_ids = get_commands(cohs)
        for cmd_id in cmd_ids:
            self.statistics.watchdog_schedule(cmd_id)
        switch_commands_to_start(cohs)

        self.logger.debug("Cohs %s starting" % 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
Esempio n. 4
0
    def start_commands_on_host(self, cohs):
        """
        Starts selected commands on host.

        @param cmd_ids: list of commands ids
        @type cmd_ids: list
        """
        cmd_ids = get_commands(cohs)
        for cmd_id in cmd_ids:
            self.statistics.watchdog_schedule(cmd_id)
        switch_commands_to_start(cohs)

        self.logger.debug("Cohs %s starting" % 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