python/ray/state.py
def _available_resources_per_node(self):
        """Returns a dictionary mapping node id to avaiable resources."""
        self._check_connected()
        available_resources_by_id = {}

        all_available_resources = (
            self.global_state_accessor.get_all_available_resources()
        )
        for available_resource in all_available_resources:
            message = gcs_utils.AvailableResources.FromString(available_resource)
            # Calculate available resources for this node.
            dynamic_resources = {}
            for resource_id, capacity in message.resources_available.items():
                dynamic_resources[resource_id] = capacity
            # Update available resources for this node.
            node_id = ray._private.utils.binary_to_hex(message.node_id)
            available_resources_by_id[node_id] = dynamic_resources

        # Update nodes in cluster.
        node_ids = self._live_node_ids()
        # Remove disconnected nodes.
        for node_id in list(available_resources_by_id.keys()):
            if node_id not in node_ids:
                del available_resources_by_id[node_id]

        return available_resources_by_id
Returns a dictionary mapping node id to avaiable resources.
Returns a dictionary mapping node id to avaiable resources.
Returns a dictionary mapping node id to avaiable resources .
def _available_resources_per_node(self):
        self._check_connected()
        available_resources_by_id = {}
        all_available_resources = (
            self.global_state_accessor.get_all_available_resources()
        )
        for available_resource in all_available_resources:
            message = gcs_utils.AvailableResources.FromString(available_resource)
            dynamic_resources = {}
            for resource_id, capacity in message.resources_available.items():
                dynamic_resources[resource_id] = capacity
            node_id = ray._private.utils.binary_to_hex(message.node_id)
            available_resources_by_id[node_id] = dynamic_resources
        node_ids = self._live_node_ids()
        for node_id in list(available_resources_by_id.keys()):
            if node_id not in node_ids:
                del available_resources_by_id[node_id]
        return available_resources_by_id
def _available_resources_per_node ( self ) : self . _check_connected ( ) available_resources_by_id = { } all_available_resources = ( self . global_state_accessor . get_all_available_resources ( ) ) for available_resource in all_available_resources : message = gcs_utils . AvailableResources . FromString ( available_resource ) dynamic_resources = { } for resource_id , capacity in message . resources_available . items ( ) : dynamic_resources [ resource_id ] = capacity node_id = ray . _private . utils . binary_to_hex ( message . node_id ) available_resources_by_id [ node_id ] = dynamic_resources node_ids = self . _live_node_ids ( ) for node_id in list ( available_resources_by_id . keys ( ) ) : if node_id not in node_ids : del available_resources_by_id [ node_id ] return available_resources_by_id
Returns a dictionary mapping node id to avaiable resources.
Returns a dictionary mapping node id to avaiable resources .
"""Returns a dictionary mapping node id to avaiable resources.""" # Calculate available resources for this node. # Update available resources for this node. # Update nodes in cluster. # Remove disconnected nodes.
self