(self, nodes)
return parsed_nodes
Parse nodes to retrieve memory and cpu of each node

        :param nodes: The output of k8s_api.list_namespaced_node()
        For example:
        {
            'items': [{
                'status': {
                    'phase': None,
                    'capacity': "{u'cpu': u'1',
                                  u'memory': u'2049852Ki'}",
                },
            }],
            'api_version': None,
            'kind': 'NodeList',
            'api_version': 'v1',
        }

        The above output is the dict form of:
        k8sclient.client.models.v1_node_list.
        V1NodeList object

        :return: CPU core number and Memory size of each node. Example:
            [{'cpu': 1, 'Memory': 1024.0},
             {'cpu': 1, 'Memory': 1024.0}]
Parse nodes to retrieve memory and cpu of each node
Parse nodes to retrieve memory and cpu of each node
def _parse_node_info(self, nodes):
        """Parse nodes to retrieve memory and cpu of each node

        :param nodes: The output of k8s_api.list_namespaced_node()
        For example:
        {
            'items': [{
                'status': {
                    'phase': None,
                    'capacity': "{u'cpu': u'1',
                                  u'memory': u'2049852Ki'}",
                },
            }],
            'api_version': None,
            'kind': 'NodeList',
            'api_version': 'v1',
        }

        The above output is the dict form of:
        k8sclient.client.models.v1_node_list.
        V1NodeList object

        :return: CPU core number and Memory size of each node. Example:
            [{'cpu': 1, 'Memory': 1024.0},
             {'cpu': 1, 'Memory': 1024.0}]

        """
        nodes = nodes.items
        parsed_nodes = []
        for node in nodes:
            # Output of node.status.capacity is strong
            # for example:
            # capacity = "{'cpu': '1', 'memory': '1000Ki'}"
            capacity = node.status.capacity
            memory = utils.get_k8s_quantity(capacity['memory'])
            cpu = int(capacity['cpu'])
            parsed_nodes.append({'Memory': memory, 'Cpu': cpu})

        return parsed_nodes
def _parse_node_info ( self , nodes ) : nodes = nodes . items parsed_nodes = [ ] for node in nodes : # Output of node.status.capacity is strong # for example: # capacity = "{'cpu': '1', 'memory': '1000Ki'}" capacity = node . status . capacity memory = utils . get_k8s_quantity ( capacity [ 'memory' ] ) cpu = int ( capacity [ 'cpu' ] ) parsed_nodes . append ( { 'Memory' : memory , 'Cpu' : cpu } ) return parsed_nodes