yr.resources

Contents

yr.resources#

yr.resources() List[dict][source]#

Get the resource information of nodes in the cluster.

When requesting resource information, you need to configure master_addr_list in yr.Config.

Returns:

list[dict], The resource information of nodes in the cluster. The dict contains the following keys,

  • id: The name of the node.

  • capacity: The total resources of the node.

  • allocatable: The available resources of the node.

  • status: The status of the node. 0 indicates normal.

Raises:

RuntimeError – If the information retrieval from the functionsystem master fails.

Examples

>>> import yr
>>> yr.init()
>>>
>>> res = yr.resources()
>>> print(res)
[{'id': 'function-agent-172.17.0.2-25742','status': 0, 'capacity': {'CPU': 1000.0, 'Memory': 8192.0},
'allocatable': {'CPU': 500.0, 'Memory': 4096.0}}]
>>>
>>> yr.finalize()