Query Worker runtime¶
Query the runtime replica status of a compute instance by Worker type.
GET https://moi.matrixorigin.cn/newmoi/compute-resources/{resource_id}/runtime
Preparation before calling¶
First Query the computing instance details] and confirm the instance you want to query. Prepare a personal access token with access to the target workspace, the target workspace ID, and the compute instance ID.
The example below uses:
$AI_STUDIO_API_KEY: The actual personal access token, passed through theX-API-KeyHeader.$WORKSPACE_ID: Target workspace ID, passed throughX-Workspace-IDHeader.$RESOURCE_ID: The computing instance ID to be queried.
Request example¶
curl "https://moi.matrixorigin.cn/newmoi/compute-resources/$RESOURCE_ID/runtime" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID"
Path parameters¶
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
Compute instance ID. |
Successful response¶
Returns 200 on success, data.runtimes lists the runtime records of each type of Worker.
{
"code": "OK",
"msg": "OK",
"data": {
"runtimes": [
{
"compute_resource_id": "cr-001",
"worker_type": "python-worker",
"status": "ACTIVE",
"desired_replicas": 1,
"current_replicas": 1
}
]
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
string |
|
|
string |
|
|
object |
Worker runtime object. |
|
object[] |
Runtime records for each type of Worker. |
|
string |
Compute instance ID. |
|
string |
Worker type. |
|
string |
The running status of this Worker. |
|
integer |
Number of target copies. |
|
integer |
The current number of copies. |
|
string |
Last activation time; returned if there is a value. |
|
string |
Last active time; returned if there is a value. |
|
string |
Runtime record creation time. |
|
string |
Record the last update time during runtime. |
In this document, [] after a type means an array; for example, object[] is an array of objects. In field paths, [] means each item in an array; for example, data.runtimes[].compute_resource_id is the compute_resource_id field of each item in data.runtimes.
Error response¶
{
"code": "NOT_FOUND",
"msg": "计算资源不存在",
"data": null
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
— |
Missing or invalid access credentials. |
Check API Key and Workspace Header. |
|
|
The current identity does not have permission to read the running status of the instance. |
Use valid credentials, or contact your administrator for authorization. |
|
|
The instance does not exist or does not belong to the current workspace. |
Check |
|
|
The service cannot read the Worker running status. |
Record the request time and error message and try again. |
Follow-up operations¶
Return to Query calculation instance details to view the overall status, or Update calculation instance to adjust the configuration.