示例#1
0
 def stream_manage_reboots(self):
     dead_instances = []
     self.instances = \
         utils.filter_move(lambda i: self.instances_nrm[i.id].check(),
                           self.instances, dead_instances)
     for instance in dead_instances:
         del self.instances_nrm[instance.id]
示例#2
0
 def stream_manage_reboots(self):
     dead_instances = []
     self.instances = \
         utils.filter_move(lambda i: self.instances_nrm[i.id].check(),
                           self.instances, dead_instances)
     for instance in dead_instances:
         del self.instances_nrm[instance.id]
示例#3
0
    def stream_instances(self):
        if not self.instances:
            return

        ssh_up = self.cluster.pool.map(lambda i: i.is_up(), self.instances)
        zip_instances = utils.filter_move(
            lambda i: i[0].state != 'running' or not i[1],
            zip(self.instances, ssh_up), self.ready_instances, lambda i: i[0])
        self.instances = [i[0] for i in zip_instances]
        if self.instances:
            log.info("Still waiting for instances: " + str(self.instances))
示例#4
0
    def stream_unpropagated_spots(self):
        if not self.unpropagated_spots:
            return

        propagated_spot_ids, _ = self.cluster.ec2.check_for_propagation(
            spot_ids=[s.id for s in self.unpropagated_spots])
        self.unpropagated_spots = utils.filter_move(
            lambda s: s.id not in propagated_spot_ids,
            self.unpropagated_spots, self.spots)
        if self.unpropagated_spots:
            log.info("Still waiting for unpropagated spots:"
                     + str(self.unpropagated_spots))
示例#5
0
    def stream_instances(self):
        if not self.instances:
            return

        ssh_up = self.cluster.pool.map(lambda i: i.is_up(), self.instances)
        zip_instances = utils.filter_move(
            lambda i: i[0].state != 'running' or not i[1],
            zip(self.instances, ssh_up), self.ready_instances,
            lambda i: i[0])
        self.instances = [i[0] for i in zip_instances]
        if self.instances:
            log.info("Still waiting for instances: " + str(self.instances))
示例#6
0
    def stream_unpropagated_spots(self):
        if not self.unpropagated_spots:
            return

        propagated_spot_ids, _ = self.cluster.ec2.check_for_propagation(
            spot_ids=[s.id for s in self.unpropagated_spots])
        self.unpropagated_spots = utils.filter_move(
            lambda s: s.id not in propagated_spot_ids, self.unpropagated_spots,
            self.spots)
        if self.unpropagated_spots:
            log.info("Still waiting for unpropagated spots:" +
                     str(self.unpropagated_spots))
示例#7
0
    def stream_unpropagated_instances(self):
        if not self.unpropagated_instances:
            return

        _, propagated_instance_ids = self.cluster.ec2.check_for_propagation(
            instance_ids=[s.id for s in self. unpropagated_instances])
        self.unpropagated_instances = utils.filter_move(
            lambda i: i.id not in propagated_instance_ids,
            self.unpropagated_instances, self.instances)
        if self.unpropagated_instances:
            log.info("Still waiting for unpropagated instances: "
                     + str(self.unpropagated_instances))
        self.instances = self.cluster.get_nodes_or_raise(nodes=self.instances)
示例#8
0
    def stream_unpropagated_instances(self):
        if not self.unpropagated_instances:
            return

        _, propagated_instance_ids = self.cluster.ec2.check_for_propagation(
            instance_ids=[s.id for s in self.unpropagated_instances])
        self.unpropagated_instances = utils.filter_move(
            lambda i: i.id not in propagated_instance_ids,
            self.unpropagated_instances, self.instances)
        if self.unpropagated_instances:
            log.info("Still waiting for unpropagated instances: " +
                     str(self.unpropagated_instances))
        self.instances = self.cluster.get_nodes_or_raise(nodes=self.instances)
示例#9
0
    def filter_etc_hosts_lines(cls, nodes, lines):
        to_remove = \
            [n.short_alias + "|"
             + "^" + n.private_ip_address.replace(".", "\.") + "\s"
             for n in nodes]
        expr = re.compile("|".join(to_remove))
        rejected_lines = []
        lines = utils.filter_move(
            lambda line: bool(line) and not expr.findall(line),
            lines, rejected_lines)

        if rejected_lines:
            log.debug("Filtered out: {}".format(rejected_lines))
        return lines, rejected_lines
示例#10
0
    def filter_etc_hosts_lines(cls, nodes, lines):
        to_remove = \
            [n.short_alias + "|"
             + "^" + n.private_ip_address.replace(".", "\.") + "\s"
             for n in nodes]
        expr = re.compile("|".join(to_remove))
        rejected_lines = []
        lines = utils.filter_move(
            lambda line: bool(line) and not expr.findall(line),
            lines, rejected_lines)

        if rejected_lines:
            log.debug("Filtered out: {}".format(rejected_lines))
        return lines, rejected_lines
示例#11
0
    def stream_spots(self):
        if not self.spots:
            return

        instance_ids = []
        self.spots = self.cluster.get_spot_requests_or_raise(self.spots)
        self.spots = utils.filter_move(
            lambda s: s.state != 'active' or s.instance_id is None,
            self.spots, instance_ids, lambda s: s.instance_id)
        if instance_ids:
            log.info("Instance ids:" + str(instance_ids))
            for instance_id in instance_ids:
                self.unpropagated_instances.append(
                    UnpropagatedInstance(instance_id))
        if self.spots:
            self.spots = \
                self.cluster.ec2.cancel_stuck_spot_instance_request(self.spots)
        if self.spots:
            log.info("Still waiting for spots: " + str(self.spots))
示例#12
0
    def stream_spots(self):
        if not self.spots:
            return

        instance_ids = []
        self.spots = self.cluster.get_spot_requests_or_raise(self.spots)
        self.spots = utils.filter_move(
            lambda s: s.state != 'active' or s.instance_id is None, self.spots,
            instance_ids, lambda s: s.instance_id)
        if instance_ids:
            log.info("Instance ids:" + str(instance_ids))
            for instance_id in instance_ids:
                self.unpropagated_instances.append(
                    UnpropagatedInstance(instance_id))
        if self.spots:
            self.spots = \
                self.cluster.ec2.cancel_stuck_spot_instance_request(self.spots)
        if self.spots:
            log.info("Still waiting for spots: " + str(self.spots))