Querying the Real-Time Resource Usage
Function
This API is used to obtain the real-time usage of all resource pools in the current project. This API is used when you need to query the real-time usage of resource pools when monitoring resource usage, optimizing resources, planning capacity, or troubleshooting faults. The resource usage includes the usage of CPU, memory, and storage resources. Before using this API, ensure that you have the required permission and there is a running resource pool. After the query, the API returns the real-time usage data of the resource pool, including the usage percentage, resource type, and timestamp. If you do not have the required permission, the resource pool does not exist, or the system cannot obtain the real-time data, the API will return an error message.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, the following identity policy-based permissions are required.
URI
GET /v2/{project_id}/metrics/runtime/pools
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition: User project ID. For details, see Obtaining a Project ID and Name. Constraints: N/A Range: N/A Default Value: N/A |
Request Parameters
None
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| apiVersion | String | Definition: Resource version. Range: |
| kind | String | Definition: Resource type. Range: |
| items | Array of MetricsItem objects | Definition: Metric list. |
| Parameter | Type | Description |
|---|---|---|
| table | MetricTableItem object | Definition: Resource list. |
| metadata | ResourceMetricsMetadata object | Definition: Resource metric metadata. |
| Parameter | Type | Description |
|---|---|---|
| allocated | Allocated object | Definition: Allocated resources. |
| capacity | Capacity object | Definition: Resource capacity. |
| available | Available object | Definition: Available resource capacity, excluding the allocated resources, that is, the total resource capacity minus the amount of faulty resources and hot standby nodes. |
| workload | Workload object | Definition: Workload statistics. |
| Parameter | Type | Description |
|---|---|---|
| value | Value object | Definition: Number of resources. |
| timestamp | String | Definition: UTC time, in the format of yyyy-MM-dd'T'HH:mm:ss'Z'. Range: N/A |
| window | String | Definition: Statistics interval. 1s indicates 1 second, 1m indicates 1 minute, and 1h indicates 1 hour. Range: N/A |
| Parameter | Type | Description |
|---|---|---|
| value | Value object | Definition: Resource capacity minus the number of faulty resources. |
| maxValue | Value object | Definition: Maximum elastic resource capacity minus the number of faulty resources. |
| allValue | Value object | Definition: Number of resources. |
| allMaxValue | Value object | Definition: Maximum elastic resource capacity. |
| timestamp | String | Definition: UTC time, in the format of yyyy-MM-dd'T'HH:mm:ss'Z'. Range: N/A |
| window | String | Definition: Statistics interval. 1s indicates 1 second, 1m indicates 1 minute, and 1h indicates 1 hour. Range: N/A |
| Parameter | Type | Description |
|---|---|---|
| value | Value object | Resource capacity minus the amount of faulty resources and hot standby nodes. |
| maxValue | AnyType | Maximum elastic resource capacity minus the amount of faulty resources and hot standby nodes. |
| timestamp | String | UTC time, in the format of yyyy-MM-dd'T'HH:mm:ss'Z'. |
| window | String | Statistics interval. 1s indicates 1 second, 1m indicates 1 minute, and 1h indicates 1 hour. |
| Parameter | Type | Description |
|---|---|---|
| cpu | String | Definition: CPU quantity, that is, the amount of compute resources. Range: N/A |
| memory | String | Definition: Memory. Range: N/A |
| tnt004 | String | Definition: Number of GPUs. Range: N/A |
| Parameter | Type | Description |
|---|---|---|
| allocated | WorkloadStatistics object | Workload statistics of delivered jobs. |
| queue | WorkloadStatistics object | Workload statistics of jobs in the queue. |
| timestamp | String | UTC time, in the format of yyyy-MM-dd'T'HH:mm:ss'Z'. |
| window | String | Statistics interval. 1s indicates 1 second, 1m indicates 1 minute, and 1h indicates 1 hour. |
| Parameter | Type | Description |
|---|---|---|
| infer | Integer | Number of model deployment jobs of the old version. |
| notebook | Integer | Number of development environment jobs. |
| train | Integer | Number of training jobs. |
| warmUpTask | Integer | Number of weight warmup jobs. |
| x-infer | Integer | Number of model deployment jobs. |
| sum | Integer | Total number of jobs. |
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"
},
"available" : {
"value" : {
"cpu" : 16,
"memory" : "64Gi",
"tnt004" : 2
},
"maxValue" : {
"cpu" : 16,
"memory" : "64Gi",
"tnt004" : 2
},
"timestamp" : "2022-03-30T07:09:10Z",
"window" : "1m"
},
"workload" : {
"allocated" : {
"infer" : 0,
"train" : 2,
"warmUpTask" : 1,
"notebook" : 0,
"x-infer" : 1,
"sum" : 4
},
"queue" : {
"infer" : 0,
"train" : 3,
"warmUpTask" : 0,
"notebook" : 0,
"x-infer" : 0,
"sum" : 3
},
"timestamp" : "2022-03-30T07:09:10Z",
"window" : "1m"
},
"capacity" : {
"value" : {
"cpu" : 16,
"memory" : "64Gi",
"tnt004" : 2
},
"maxValue" : {
"cpu" : 16,
"memory" : "64Gi",
"tnt004" : 2
},
"allValue" : {
"cpu" : 16,
"memory" : "64Gi",
"tnt004" : 2
},
"allMaxValue" : {
"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.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot