查询 Worker 运行时

查询计算实例按 Worker 类型划分的运行时副本状态。

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

调用前准备

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

下方示例使用:

  • $AI_STUDIO_API_KEY:实际个人访问令牌,通过 X-API-Key Header 传递。

  • $WORKSPACE_ID:目标工作区 ID,通过 X-Workspace-ID Header 传递。

  • $RESOURCE_ID:要查询的计算实例 ID。

路径参数

参数

类型

是否必填

说明

resource_id

string

计算实例 ID。

请求示例

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"

成功响应

成功时返回 200data.runtimes 列出每种 Worker 的运行时记录。

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

响应字段如下。

字段路径中的 [] 表示数组中的每一项。例如,data.runtimes[].compute_resource_id 表示 data.runtimes 数组中每一项的 compute_resource_id 字段。

字段

类型

说明

code

string

成功时为 OK

msg

string

成功时为 OK

data

object

Worker 运行时对象。

data.runtimes

object(对象数组)

每种 Worker 的运行时记录。

data.runtimes[].compute_resource_id

string

计算实例 ID。

data.runtimes[].worker_type

string

Worker 类型。

data.runtimes[].status

string

此 Worker 的运行状态。

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

运行时记录创建时间。

data.runtimes[].updated_at

string

运行时记录最后更新时间。

错误响应

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

常见 HTTP 错误

HTTP 状态码

错误代码

常见原因

建议操作

401

缺少或无效的访问凭据。

检查 API Key 和工作区 Header。

403

ErrForbidden

当前身份没有读取实例运行状态的权限。

使用有权限的凭据,或联系管理员授权。

404

NOT_FOUND

实例不存在,或不属于当前工作区。

检查 resource_id 和工作区。

500

LIST_RUNTIME_FAILED

服务无法读取 Worker 运行状态。

记录请求时间和错误信息后重试。

后续操作

返回查询计算实例详情查看整体状态,或更新计算实例调整配置。

最后更新于