Help Center> ModelArts> API Reference> Resource Management> Querying the Real-Time Resource Usage
Updated on 2024-06-06 GMT+08:00

Querying the Real-Time Resource Usage

Function

Query the real-time usage of all resource pools in the current project.

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

URI

GET /v2/{project_id}/metrics/runtime/pools

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details, see Obtaining a Project ID and Name.

Request Parameters

None

Response Parameters

Status code: 200

Table 2 Response body parameters

Parameter

Type

Description

apiVersion

String

Resource version. Options:

  • os.modelarts.xxxxx/v2

kind

String

Resource type. Options:

  • PoolMetricsList

items

Array of MetricsItem objects

Metric list

Table 3 MetricsItem

Parameter

Type

Description

table

table object

Resource list.

metadata

ResourceMetricsMetadata object

Indicates the metadata of a resource indicator.

Table 4 table

Parameter

Type

Description

allocated

Allocated object

Allocated resources.

capacity

Capacity object

Total resource capacity.

Table 5 Allocated

Parameter

Type

Description

value

Value object

Resource amount.

timestamp

String

UTC time, in the format of yyyy-MM-dd'T'HH:mm:ss'Z'.

window

String

Statistical interval. 1s indicates 1 second, 1m indicates 1 minute, and 1h indicates 1 hour.

Table 6 Capacity

Parameter

Type

Description

value

Value object

Resource amount.

maxValue

Value object

Maximum number of elastic resources.

timestamp

String

UTC time, in the format of yyyy-MM-dd'T'HH:mm:ss'Z'.

window

String

Statistical interval. 1s indicates 1 second, 1m indicates 1 minute, and 1h indicates 1 hour.

Table 7 Value

Parameter

Type

Description

cpu

String

Number of CPUs, that is, number of computing resources.

memory

String

Memory.

tnt004

String

Number of GPUs.

Table 8 ResourceMetricsMetadata

Parameter

Type

Description

name

String

Name of a resource indicator.

labels

Object

Specifies the tag information of a resource metric.

Example Requests

GET https://{endpoint}/v2/{project_id}/metrics/runtime/pools

Example Responses

Status code: 200

OK.

{
  "apiVersion" : "v2",
  "kind" : "PoolMetricsList",
  "items" : [ {
    "table" : {
      "allocated" : {
        "value" : {
          "cpu" : 5,
          "memory" : "15548Mi",
          "tnt004" : "1073m"
        },
        "timestamp" : "2022-03-30T07:09:10Z",
        "window" : "1m"
      },
      "capacity" : {
        "value" : {
          "cpu" : 16,
          "memory" : "64Gi",
          "tnt004" : 2
        },
        "maxValue" : {
          "cpu" : 16,
          "memory" : "64Gi",
          "tnt004" : 2
        },
        "timestamp" : "2022-03-30T07:09:10Z",
        "window" : "1m"
      }
    },
    "metadata" : {
      "name" : "hougang-rse-pool"
    }
  } ]
}

Status Codes

Status Code

Description

200

OK.

Error Codes

See Error Codes.