Update calculation specifications¶
Update the definition of a calculation specification.
PUT https://moi.matrixorigin.cn/newmoi/compute-resource-specs/{spec_id}
Preparation before calling¶
First list the calculation specifications and confirm the specifications to be updated. Prepare the personal access token, target workspace ID, and spec ID that have access to the target workspace.
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.$SPEC_ID: ID of the compute spec to be updated, taken from the response of List compute spec.
First Query the calculation specification management permission. The specification can only be updated if the result is true. The request body is defined with complete specifications, and family_name_en cannot be empty.
Request example¶
curl -X PUT "https://moi.matrixorigin.cn/newmoi/compute-resource-specs/$SPEC_ID" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d '{
"id": "task-standard-small",
"kind": "task",
"family": "standard",
"family_name": "标准",
"family_name_en": "Standard",
"cpu_milli": 2000,
"memory_mib": 4096,
"gpu_count": 0,
"gpu_memory_mib": 0,
"gpu_cores": 0,
"credit_per_hour": 1,
"enabled": true
}'
Path parameters¶
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
ID of the compute specification to update. |
Request body¶
The request body is the complete specification definition. All required fields must be submitted except id which can be omitted; omitting enabled will set the specification to disabled.
Field |
Type |
Required |
Description |
|---|---|---|---|
|
string |
No |
Spec ID; must be provided consistent with |
|
string |
Yes |
Resource type, can only be |
|
string |
Yes |
Spec family identifier. |
|
string |
Yes |
Specification family name. |
|
string |
Yes |
English name of the specification family; cannot be empty. |
|
integer |
Yes |
CPU capacity, in millicore, must be greater than |
|
integer |
Yes |
Memory capacity, in MiB, must be greater than |
|
integer |
No |
Number of GPUs, cannot be less than |
|
integer |
No |
GPU memory, in MiB, cannot be smaller than |
|
integer |
No |
Number of GPU cores, cannot be less than |
|
number |
No |
Credit usage per hour, cannot be less than |
|
string |
No |
Specification. |
|
object |
No |
Node scheduling configuration. |
|
boolean |
No |
Whether to allow the use of this specification; when omitted, it is |
Successful response¶
Returns 200 on success. data Returns the updated specification object.
{
"code": "OK",
"msg": "OK",
"data": {
"id": "task-standard-small",
"kind": "task",
"family": "standard",
"family_name": "标准",
"family_name_en": "Standard",
"cpu_milli": 2000,
"memory_mib": 4096,
"gpu_count": 0,
"gpu_memory_mib": 0,
"gpu_cores": 0,
"credit_per_hour": 1,
"description": "用于常规任务",
"node_placement": {},
"enabled": true
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
string |
|
|
string |
|
|
string |
Updated specification ID. |
|
string |
Resource type. |
|
string |
Specification family identifier. |
|
string |
Specification family name. |
|
string |
English name of the specification family. |
|
integer |
CPU capacity in millicore. |
|
integer |
Memory capacity in MiB. |
|
integer |
Number of GPUs. |
|
integer |
GPU memory, unit is MiB. |
|
integer |
Number of GPU cores. |
|
number |
Credit usage per hour. |
|
string |
Specification. |
|
string |
English specifications; system specifications can be returned. |
|
object |
Node scheduling configuration. |
|
boolean |
Updated enabled status. |
|
boolean |
Whether it is a built-in specification of the system. |
|
string |
Creator ID. |
|
string |
The last updater ID. |
|
string |
Creation time. |
|
string |
Last updated time. |
Error response¶
{
"code": "INVALID_PARAMS",
"msg": "family_name_en is required",
"data": null
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
The request body could not be parsed or |
Check JSON format and provide non-empty |
|
— |
Missing, invalid or expired access credentials. |
Check API Key. |
|
|
The current identity does not have specification management rights. |
Try again using an identity with appropriate permissions. |
|
|
The specification corresponding to |
First list the calculation specifications, and confirm the path parameters. |
|
— |
The updated definition conflicts with existing specifications. |
Modify the conflicting fields and try again. |
|
|
The server failed to update the specifications. |
Retain the error message and try again later; if failure persists, contact support. |
Follow-up operations¶
To simply toggle availability, use Enable or disable calculation specifications.