Query Worker runtime

Query the runtime replica status of a compute instance by Worker type.

GET https://moi.matrixorigin.cn/newmoi/compute-resources/{resource_id}/runtime

Preparation before calling

First Query the computing instance details] and confirm the instance you want to query. 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: The computing instance ID to be queried.

Request example

curl "https://moi.matrixorigin.cn/newmoi/compute-resources/$RESOURCE_ID/runtime" \
  -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

Returns 200 on success, data.runtimes lists the runtime records of each type of Worker.

{
  "code": "OK",
  "msg": "OK",
  "data": {
    "runtimes": [
      {
        "compute_resource_id": "cr-001",
        "worker_type": "python-worker",
        "status": "ACTIVE",
        "desired_replicas": 1,
        "current_replicas": 1
      }
    ]
  }
}

The response fields are as follows.

Field

Type

Description

code

string

OK on success.

msg

string

OK on success.

data

object

Worker runtime object.

data.runtimes

object[]

Runtime records for each type of Worker.

data.runtimes[].compute_resource_id

string

Compute instance ID.

data.runtimes[].worker_type

string

Worker type.

data.runtimes[].status

string

The running status of this Worker.

data.runtimes[].desired_replicas

integer

Number of target copies.

data.runtimes[].current_replicas

integer

The current number of copies.

data.runtimes[].last_activation_at

string

Last activation time; returned if there is a value.

data.runtimes[].last_active_at

string

Last active time; returned if there is a value.

data.runtimes[].created_at

string

Runtime record creation time.

data.runtimes[].updated_at

string

Record the last update time during runtime.

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, data.runtimes[].compute_resource_id is the compute_resource_id field of each item in data.runtimes.

Error response

{
  "code": "NOT_FOUND",
  "msg": "计算资源不存在",
  "data": null
}

Common HTTP errors

HTTP status code

error code

Common causes

Recommended actions

401

Missing or invalid access credentials.

Check API Key and Workspace Header.

403

ErrForbidden

The current identity does not have permission to read the running status of the instance.

Use valid credentials, or contact your administrator for authorization.

404

NOT_FOUND

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

Check resource_id and workspace.

500

LIST_RUNTIME_FAILED

The service cannot read the Worker running status.

Record the request time and error message and try again.

Follow-up operations

Return to Query calculation instance details to view the overall status, or Update calculation instance to adjust the configuration.

Last updated on