Pause the calculation instance

Pauses a compute instance in the ACTIVE state, stops its workers, and transitions the instance to SUSPENDED. You must check the details to confirm the status before requesting.

POST https://api.moi.matrixorigin.cn/v5/compute-resources/{resource_id}/suspend

Preparation before calling

First query the calculation instance details and confirm that the instance status is ACTIVE. IDLE, SUSPENDED, ERROR or transition states cannot be paused. 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 the X-API-Key Header.

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

  • $RESOURCE_ID: ID of the compute instance to pause.

Pausing affects workloads that use the instance.

Request example

curl -X POST "https://api.moi.matrixorigin.cn/v5/compute-resources/$RESOURCE_ID/suspend" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"

Path parameters

Parameter

Type

Required

Description

resource_id

string

Yes

Compute instance ID.

Successful response

When successful, 200 is returned, and data is the calculation instance object.

{
  "code": "OK",
  "msg": "OK",
  "data": {
    "id": "cr-001",
    "name": "data-processing",
    "spec_id": "task-standard-small",
    "status": "SUSPENDED",
    "status_message": "",
    "min_replicas": 0,
    "max_replicas": 2,
    "current_replicas": 0
  }
}

The response fields are as follows.

Field

Type

Description

code

string

OK on success.

msg

string

OK on success.

data.id

string

Compute instance ID.

data.workspace_id

string

ID of the workspace to which it belongs.

data.name

string

Compute instance name.

data.description

string

Example description; returned when there is a value.

data.spec_id

string

Compute spec ID.

data.kind

string

Instance type.

data.cpu

integer

CPU configuration value.

data.memory_gib

integer

Configuration value expressed in GiB of memory.

data.gpu

integer

GPU configuration value.

data.cpu_milli

integer

CPU configuration value in millicores.

data.memory_mib

integer

Configuration value expressed in MiB of memory.

data.gpu_count

integer

Number of GPUs.

data.gpu_memory_mib

integer

MiB of video memory for a single GPU.

data.gpu_cores

integer

Number of GPU cores.

data.min_replicas

integer

Serverless instances are fixed to 0.

data.max_replicas

integer

Maximum number of copies.

data.desired_replicas

integer

Number of target copies.

data.current_replicas

integer

The current number of copies.

data.go_worker_image_id

string

Go Worker image ID; returned if there is a value.

data.python_worker_image_id

string

Python Worker image ID; returned if there is a value.

data.worker_images

array of object

Worker image selection; returned when there is a value.

data.worker_images[].worker_type

string

Worker type.

data.worker_images[].image_id

string

Image ID.

data.worker_images[].platform

string

Running platform.

data.platform

string

Instance running platform; returned if there is a value.

data.auto_suspend_minutes

integer

Automatic pause waiting time.

data.is_default

boolean

Whether it is the default computing instance of the workspace.

data.status

string

SUSPENDED on success.

data.status_message

string

Supplementary status information.

data.scale_reason

string

The scaling reason provided by the server; returned if there is a value.

data.last_activation_at

string

Last activation time; returned if there is a value.

data.last_active_at

string

Last active time; returned if there is a value.

data.created_by

string

Creator ID; returned if there is a value.

data.created_at

string

Creation time; returned if there is a value.

data.updated_at

string

Last updated time; returned if there is a value.

In this document, [] after a type means an array; for example, array of object is an array of objects. In field paths, [] means each item in an array; for example, data.worker_images[].worker_type is the worker_type field of each item in data.worker_images.

Error response

{
  "code": "SUSPEND_FAILED",
  "msg": "请求参数无效",
  "data": null
}

Common HTTP errors

HTTP status code

error code

Common causes

Recommended actions

400

SUSPEND_FAILED

The instance ID is invalid or the current state does not allow suspension.

Check the instance details first, confirm the status and try again.

401

—

Missing or invalid access credentials.

Check API Key and Workspace Header.

403

ErrForbidden

The current identity does not have instance operation permissions.

Requesting permission to compute_resource.operate.

404

NOT_FOUND

The instance does not exist or does not belong to the current workspace.

Check resource_id and workspace.

409

ErrConflict

The instance status conflicts with this operation.

Read the latest status before operating.

500

SUSPEND_FAILED

The server failed to handle the pause request.

Try again later.

Follow-up operations

Query calculation instance details, and Restore computing instance when it needs to be reused.

Last updated on