Update calculation instance¶
Updates the modifiable configuration of a compute instance in the current workspace. Serverless instances do not deploy workers immediately due to configuration updates; workers are activated based on subsequent workload demand.
PUT https://moi.matrixorigin.cn/newmoi/compute-resources/{resource_id}
Preparation before calling¶
First query the computing instance details and confirm the instance to be updated. 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: Compute instance ID to update.
Request example¶
curl -X PUT "https://moi.matrixorigin.cn/newmoi/compute-resources/$RESOURCE_ID" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d '{
"description": "updated",
"max_replicas": 3,
"auto_suspend_minutes": 30
}'
Path parameters¶
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
Compute instance ID. |
Request body¶
Submit only the fields you want to modify.
Field |
Type |
Required |
Description |
|---|---|---|---|
|
string |
No |
Instance name. |
|
string |
No |
Example description. |
|
string |
No |
Compatibility tip. |
|
string |
No |
Compute spec ID. |
|
integer |
No |
CPU configuration. |
|
integer |
No |
Memory GiB configuration. |
|
integer |
No |
GPU configuration. |
|
integer |
No |
Only accepts |
|
integer |
No |
The upper limit of copies, must be greater than |
|
integer |
No |
Automatic pause waiting time. |
|
object[] |
No |
Worker image selection. Submitting this field must replace the original configuration with the complete list, overwriting all currently active |
|
string |
Conditionally required |
Worker type. Required when submitting |
|
string |
No |
Compatible alias; should be consistent with |
|
string |
Conditionally required |
Image ID. Required when submitting |
|
string |
Conditionally required |
Image runtime platform. Required when submitting |
|
string |
No |
Compatible Go Worker image ID. |
|
string |
No |
Compatible Python Worker image ID. |
|
string |
No |
Compatible operating platform. |
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, worker_images[].worker_type is the worker_type field of each item in worker_images.
Successful response¶
When successful, 200 is returned, and data is the updated instance object. The worker will not be deployed immediately after saving successfully.
{
"code": "OK",
"msg": "OK",
"data": {
"id": "cr-001",
"name": "data-processing",
"description": "updated",
"spec_id": "task-standard-small",
"status": "IDLE",
"status_message": "",
"min_replicas": 0,
"max_replicas": 3,
"current_replicas": 0
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
string |
|
|
string |
|
|
string |
Compute instance ID. |
|
string |
ID of the workspace to which it belongs. |
|
string |
Compute instance name. |
|
string |
Example description; returned when there is a value. |
|
string |
Current computing specification ID. |
|
string |
Instance type. |
|
integer |
CPU configuration value. |
|
integer |
Configuration value expressed in GiB of memory. |
|
integer |
GPU configuration value. |
|
integer |
CPU configuration value in millicores. |
|
integer |
Configuration value expressed in MiB of memory. |
|
integer |
Number of GPUs. |
|
integer |
MiB of video memory for a single GPU. |
|
integer |
Number of GPU cores. |
|
integer |
Serverless instances are fixed to |
|
integer |
Maximum number of copies. |
|
integer |
Number of target copies. |
|
integer |
The current number of copies. |
|
string |
Go Worker image ID; returned if there is a value. |
|
string |
Python Worker image ID; returned if there is a value. |
|
object[] |
Worker image selection; returned when there is a value. |
|
string |
Worker type. |
|
string |
Image ID. |
|
string |
Running platform. |
|
string |
Instance running platform; returned if there is a value. |
|
integer |
Automatic pause waiting time. |
|
boolean |
Whether it is the default computing instance of the workspace. |
|
string |
The updated current life cycle status. |
|
string |
Supplementary status information; returned if there is a value. |
|
string |
The scaling reason provided by the server; returned if there is a value. |
|
string |
Last activation time; returned if there is a value. |
|
string |
Last active time; returned if there is a value. |
|
string |
Creator ID; returned if there is a value. |
|
string |
Creation time; returned if there is a value. |
|
string |
Last updated time; returned if there is a value. |
Error response¶
{
"code": "UPDATE_FAILED",
"msg": "服务器内部错误",
"data": null
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
The request body cannot be parsed or the field combination is invalid. |
Check field types, specifications and copy ranges. |
|
— |
Missing or invalid access credentials. |
Check API Key and Workspace Header. |
|
|
The current identity does not have instance update permission. |
Requesting permission to |
|
|
The instance does not exist or does not belong to the current workspace. |
Check |
|
|
The new name conflicts with an existing instance in the workspace. |
Modify |
|
|
The server failed to update the instance. |
Try again later. |
Follow-up operations¶
Query calculation instance details or Query Worker runtime to confirm the change progress.