Enable or disable calculation specifications¶
Sets the enabled status of a compute specification.
PATCH https://moi.matrixorigin.cn/newmoi/compute-resource-specs/{spec_id}/enabled
Preparation before calling¶
First list the calculation specifications and confirm the specifications to set the status. 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: The compute spec ID to set the status for, taken from the response of List compute spec.
First Query the calculation specification management permission. The enabled status can only be modified if the result is true. Disabling a specification does not replace lifecycle management of existing compute instances.
Request example¶
curl -X PATCH "https://moi.matrixorigin.cn/newmoi/compute-resource-specs/$SPEC_ID/enabled" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d '{
"enabled": false
}'
Path parameters¶
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
The ID of the compute specification to set the state for. |
Request body¶
Field |
Type |
Required |
Description |
|---|---|---|---|
|
boolean |
No |
|
Successful response¶
Returns 200 on success. data returns the updated specification object, where enabled is the state after the request.
{
"code": "OK",
"msg": "OK",
"data": {
"id": "task-standard-small",
"enabled": false
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
string |
|
|
string |
|
|
string |
Compute spec 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": "invalid request parameters",
"data": null
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
The request body cannot be parsed, or |
Explicitly pass in |
|
— |
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 server failed to update the enabled status. |
Try again later; if it continues to fail, contact support. |
Follow-up operations¶
List calculation specifications Confirm the new status.