查询 Worker 运行状态

查询计算实例已保存的 Worker 运行记录和副本数量。结果不代表实时 Pod 状态或运行指标。

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

调用前准备

先查询计算实例详情,确认要查询的实例。准备可访问目标工作区的个人访问令牌、目标工作区 ID 和计算实例 ID。

请求参数

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

字段

类型

是否必填

说明

resource_id

string

是

计算实例 ID。

成功响应

{
  "code": "OK",
  "msg": "OK",
  "data": {
    "runtimes": [
      {
        "compute_resource_id": "cr-001",
        "worker_type": "python-worker",
        "status": "ACTIVE",
        "desired_replicas": 1,
        "current_replicas": 1,
        "created_at": "2026-10-14T00:00:00Z",
        "updated_at": "2026-10-14T00:00:00Z"
      }
    ]
  }
}

字段

类型

说明

code

string

成功代码。

msg

string

响应信息。

data

object

本次操作返回的数据。

data.runtimes

array(对象数组)

每种 Worker 的运行时记录。

data.runtimes[].compute_resource_id

string

计算实例 ID。

data.runtimes[].worker_type

string

Worker 类型。

data.runtimes[].status

string

此 Worker 的运行状态。取值为 IAM_CREATE_PENDING、IDLE、DEPLOYING、SCALING、ACTIVE、DRAINING、SUSPENDED、TERMINATING、ERROR、DELETED

data.runtimes[].desired_replicas

integer

目标副本数。

data.runtimes[].current_replicas

integer

当前副本数。

data.runtimes[].last_activation_at

string

最近一次激活时间;未设置时省略。

data.runtimes[].last_active_at

string

最近一次活跃时间;未设置时省略。

data.runtimes[].created_at

string

运行时记录创建时间。采用 RFC 3339 格式。

data.runtimes[].updated_at

string

运行时记录最后更新时间。采用 RFC 3339 格式。

错误响应

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

字段

类型

说明

code

string

错误代码。

msg

string

错误说明。

data

null

错误时为空。

常见 HTTP 错误

HTTP 状态码

错误代码

常见原因

建议操作

400

INVALID_PARAMS

请求字段、工作区或操作前置条件无效。

修正参数后再提交。

401

Unauthorized

认证凭据缺失或无效。

检查凭据类型、有效期及认证头。

403

ErrForbidden

当前身份或有效角色无执行该操作的权限。

使用有权限的身份,或联系管理员授权。

404

NOT_FOUND

目标对象或所需引用未找到。

核对对象标识、所属工作区和当前状态。

500

ErrServer

内部处理失败;写操作可能已有部分效果。

保留请求和追踪信息,先核对当前结果。

503

ErrServiceUnavailable

业务、运行时或授权依赖暂不可用。

恢复依赖后先核对已有结果,不自动重复写入。

最后更新于