Example #1
0
    def write_container_status_by_containerName(self, container_name, record):
        containerClusterName = get_containerClusterName_from_containerName(
            container_name)
        container_node = self.get_container_node_from_container_name(
            containerClusterName, container_name)

        zkOper = Container_ZkOpers()
        zkOper.write_container_status(containerClusterName, container_node,
                                      record)
Example #2
0
    def retrieve_container_status_from_containerName(self, container_name):
        cluster = get_containerClusterName_from_containerName(container_name)
        container_node = self.get_container_node_from_container_name(
            cluster, container_name)

        zkOper = Container_ZkOpers()
        status_value = zkOper.retrieve_container_status_value(
            cluster, container_node)
        return status_value
Example #3
0
 def refresh(self):
     self.old_ids = self.__current_ids
     self.__current_ids.clear()
     containers = self.docker_op.containers()
     for c in containers:
         con_id = c.get('Id')
         # e.g. u'Names': [u'/d-esh-23_6_dwl_010-n-1']
         con_name = c.get('Names', ['/NoName'])[0][1:]
         clu_name = get_containerClusterName_from_containerName(con_name)
         self.__current_ids.add(con_id)
         self.put(self.Detail(clu_name, con_name, con_id))
Example #4
0
    def write_container_node_value_by_containerName(self, container_name,
                                                    container_props):
        """only write container value and not write status value

        """
        cluster = get_containerClusterName_from_containerName(container_name)
        container_node = self.get_container_node_from_container_name(
            cluster, container_name)

        zkOper = Container_ZkOpers()
        zkOper.write_container_node_value(cluster, container_node,
                                          container_props)
    def get_container_resource(self, container_name, resource_type):
        zk_opers = Requests_ZkOpers()

        result = {}
        cluster_name = get_containerClusterName_from_containerName(
            container_name)
        node_name = self.container_opers.get_container_node_from_container_name(
            cluster_name, container_name)
        resource_value = zk_opers.retrieve_container_resource(
            cluster_name, node_name, resource_type)

        result.setdefault('value', resource_value)
        result.setdefault('containerName', container_name)
        return result
 def cluster(self, container_name):
     return get_containerClusterName_from_containerName(container_name)