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 the X-API-Key Header.

  • $WORKSPACE_ID: Target workspace ID, passed through X-Workspace-ID Header.

  • $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

spec_id

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

id

string

No

Spec ID; must be provided consistent with spec_id in the path.

kind

string

Yes

Resource type, can only be task or query.

family

string

Yes

Spec family identifier.

family_name

string

Yes

Specification family name.

family_name_en

string

Yes

English name of the specification family; cannot be empty.

cpu_milli

integer

Yes

CPU capacity, in millicore, must be greater than 0.

memory_mib

integer

Yes

Memory capacity, in MiB, must be greater than 0.

gpu_count

integer

No

Number of GPUs, cannot be less than 0.

gpu_memory_mib

integer

No

GPU memory, in MiB, cannot be smaller than 0.

gpu_cores

integer

No

Number of GPU cores, cannot be less than 0.

credit_per_hour

number

No

Credit usage per hour, cannot be less than 0.

description

string

No

Specification.

node_placement

object

No

Node scheduling configuration.

enabled

boolean

No

Whether to allow the use of this specification; when omitted, it is false.

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

code

string

OK on success.

msg

string

OK on success.

data.id

string

Updated specification ID.

data.kind

string

Resource type.

data.family

string

Specification family identifier.

data.family_name

string

Specification family name.

data.family_name_en

string

English name of the specification family.

data.cpu_milli

integer

CPU capacity in millicore.

data.memory_mib

integer

Memory capacity in MiB.

data.gpu_count

integer

Number of GPUs.

data.gpu_memory_mib

integer

GPU memory, unit is MiB.

data.gpu_cores

integer

Number of GPU cores.

data.credit_per_hour

number

Credit usage per hour.

data.description

string

Specification.

data.description_en

string

English specifications; system specifications can be returned.

data.node_placement

object

Node scheduling configuration.

data.enabled

boolean

Updated enabled status.

data.is_system

boolean

Whether it is a built-in specification of the system.

data.created_by

string

Creator ID.

data.updated_by

string

The last updater ID.

data.created_at

string

Creation time.

data.updated_at

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

400

INVALID_PARAMS

The request body could not be parsed or family_name_en was not provided.

Check JSON format and provide non-empty family_name_en.

401

Missing, invalid or expired access credentials.

Check API Key.

403

COMPUTE_RESOURCE_SPEC_FORBIDDEN

The current identity does not have specification management rights.

Try again using an identity with appropriate permissions.

404

NOT_FOUND

The specification corresponding to spec_id does not exist.

First list the calculation specifications, and confirm the path parameters.

409

The updated definition conflicts with existing specifications.

Modify the conflicting fields and try again.

500

UPDATE_SPEC_FAILED

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.

Last updated on