首批通过分布式安全可靠测评,为关键业务系统打造
查询任务详情
更新时间:2026-04-14 11:55:54
功能说明
该接口用于查询任务执行的详细信息。
调用说明
接口约束
调用者需要至少是 TASK_VIEWER 角色。
请求路径
GET /api/v2/tasks/instances/{taskInstanceId}
请求参数
path:
| 参数 | 类型 | 必选 | 示例值 | 描述 |
|---|---|---|---|---|
| taskInstanceId | Long | 是 | 1000 | 目标任务实例 ID。 |
返回结果
| 参数 | 类型 | 说明 |
|---|---|---|
| data | Object | WrappedTaskInstance 对象请求的数据,详情参见 WrappedTaskInstance 的数据结构。 |
| successful | Boolean | 请求是否成功。 |
| timestamp | Datetime | 服务端完成请求的时间戳。 |
| duration | Integer | 服务端处理请求的时间(毫秒)。 |
| status | Integer | 符合 HTTP Status 规范的编码。 |
| traceId | String | 请求的 Trace ID,用于排查问题。 |
| server | String | 响应请求的应用服务的地址。 |
WrappedTaskInstance 的数据结构
| 参数 | 类型 | 说明 |
|---|---|---|
| id | Long | 软件包 ID。 |
| name | String | 软件包名称。 |
| taskDefinitionId | Long | 任务定义 ID。 |
| cluster | Object | 集群信息,详情参见 cluster 参数说明。 |
| tenant | Object | 租户信息,详情参见 tenant 参数说明。 |
| creator | Object | 任务创建者信息,详情参见 creator 参数说明。 |
| status | StringArray | 任务执行状态,取值范围: |
| type | String | 任务类型,取值范围: |
| operation | String | 任务操作,取值范围: |
| executor | String | 执行任务的主机信息。 |
| prohibitRollback | Boolean | 是否禁止回滚。 |
| subtasks | ObjectArray | WrappedSubtaskInstance 数组子任务汇总信息,详情参见 WrappedSubtaskInstance 数据结构。 |
| createTime | String | 任务创建时间。 |
| startTime | String | 任务开始时间。 |
| finishTime | String | 任务结束时间。 |
| tags | Array | 标签信息,详情参见 InstanceFullTag 数据结构。 |
| isRemote | Boolean | 是否远程。 |
cluster 参数说明
| 参数 | 类型 | 说明 |
|---|---|---|
| id | Long | 集群在 OCP 端的 ID。 |
| name | String | 集群名称。 |
| obClusterId | Long | 集群在 OceanBase 端的 ID。 |
| type | String | 集群类型,取值范围: |
tenant 参数说明
| 参数 | 类型 | 说明 |
|---|---|---|
| id | Long | 租户在 OCP 端的 ID。 |
| name | String | 租户名称。 |
| obClusterId | Long | 租户在 OceanBase 端的 ID。 |
| mode | String | 租户模式,取值范围: |
creator 参数说明
| 参数 | 类型 | 说明 |
|---|---|---|
| id | Long | 创建者用户 ID。 |
| name | String | 创建者用户名。 |
WrappedSubtaskInstance 数据结构
| 参数 | 类型 | 说明 |
|---|---|---|
| id | Long | 子任务实例 ID。 |
| name | String | 子任务名称。 |
| seriesId | Long | 子任务序列 ID。 |
| description | String | 子任务描述信息。 |
| timeout | Integer | 子任务超时时间,单位:秒。 |
| status | String | 子任务状态,取值范围: |
| operation | String | 子任务操作,取值范围: |
| executor | String | 子任务执行节点信息。 |
| runTime | Integer | 子任务执行次数。 |
| nodeType | String | 节点类型,如 JAVA_TASK。 |
| paralleIdx | Integer | 并行子任务索引值,-1 为非并行子任务。 |
| upstreams | LongArray | 上游子任务 ID 列表。 |
| downstream | LongArray | 下游子任务 ID 列表。 |
| prohibitRollback | Boolean | 子任务是否支持回滚。 |
| createTime | String | 子任务创建时间。 |
| startTime | String | 子任务开始时间。 |
| finishTime | String | 子任务结束时间。 |
| tags | Array | 标签信息,详情参见 InstanceFullTag 数据结构。 |
InstanceFullTag 数据结构
| 参数 | 类型 | 说明 |
|---|---|---|
| clusterName | String | 集群名。 |
| clusterId | Long | OCP 侧集群 ID。 |
| obClusterId | Long | OceanBase 侧集群 ID。 |
| clusterType | String | 集群类型,包含: |
| zoneName | String | Zone 名。 |
| tenantName | String | 租户名。 |
| tenantId | Long | OCP 侧租户 ID。 |
| obTenantId | Long | OceanBase 侧租户 ID。 |
| tenantMode | String | 租户模式,包含: |
| tenantRole | String | 租户角色,包含: |
| obVersion | String | OceanBase 版本。 |
| serverId | Long | OBServer ID。 |
| arbitrationServiceId | Long | 仲裁服务 ID。 |
| arbitrationServiceGroupName | String | 仲裁服务组名称。 |
| arbitrationServiceGroupId | Long | 仲裁服务组 ID。 |
| arbitrationServiceSvrPort | Integer | 仲裁服务端口。 |
| obproxyClusterName | String | OBProxy 集群名。 |
| obproxyClusterId | Long | OBProxy 集群 ID。 |
| obproxyServerId | Long | OBProxy Server ID。 |
| hostId | Long | 主机 ID。 |
| svrIp | Long | 主机 IP。 |
| objectType | String | 任务关联对象的类型。 |
| deleted | Boolean | 标记当前任务关联的信息是否已经删除。 |
| binlogClusterName | String | Binlog 集群名。 |
| binlogClusterId | Long | Binlog 集群 ID。 |
| binlogServerId | Long | Binlog Server ID。 |
| tenantBinlogServiceId | Long | Binlog 实例 ID。 |
| binlogInstanceName | String | Binlog 实例名称。 |
示例
请求示例
GET /api/v2/tasks/instances/1000
返回示例
{
"data": {
"createTime": "2021-08-25T15:09:31+08:00",
"creator": {
"id": 100,
"name": "admin"
},
"executor": "xxx.xxx.xxx.xxx",
"finishTime": "2021-08-25T15:09:54.067+08:00",
"id": 35000312,
"name": "Reinstall OCP agent",
"operation": "EXECUTE",
"prohibitRollback": false,
"startTime": "2021-08-25T15:09:31.74+08:00",
"status": "SUCCESSFUL",
"subtasks": [
{
"createTime": "2021-08-25T15:09:31+08:00",
"description": "Install ocp agent",
"downstreams": [
13000334
],
"executor": "xxx.xxx.xxx.xxx",
"finishTime": "2021-08-25T15:09:52.182+08:00",
"id": 13000336,
"name": "Install ocp agent",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 0,
"startTime": "2021-08-25T15:09:36.821+08:00",
"status": "SUCCESSFUL",
"timeout": 5400,
"upstreams": [
13000333
]
},
{
"createTime": "2021-08-25T15:09:31+08:00",
"description": "Finish reinstalling OCP agent",
"downstreams": [],
"executor": "xxx.xxx.xxx.xxx",
"finishTime": "2021-08-25T15:09:53.252+08:00",
"id": 13000334,
"name": "Finish reinstalling OCP agent",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 1,
"startTime": "2021-08-25T15:09:53.062+08:00",
"status": "SUCCESSFUL",
"timeout": 60,
"upstreams": [
13000336
]
},
{
"createTime": "2021-08-25T15:09:31+08:00",
"description": "Uninstall ocp agent",
"downstreams": [
13000336
],
"executor": "xxx.xxx.xxx.xxx",
"finishTime": "2021-08-25T15:09:35.626+08:00",
"id": 13000333,
"name": "Uninstall ocp agent",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 2,
"startTime": "2021-08-25T15:09:33.732+08:00",
"status": "SUCCESSFUL",
"timeout": 1800,
"upstreams": [
13000335
]
},
{
"createTime": "2021-08-25T15:09:31+08:00",
"description": "Prepare reinstalling OCP agent",
"downstreams": [
13000333
],
"executor": "xxx.xxx.xxx.xxx",
"finishTime": "2021-08-25T15:09:33.082+08:00",
"id": 13000335,
"name": "Prepare reinstalling OCP agent",
"nodeType": "JAVA_TASK",
"operation": "EXECUTE",
"parallelIdx": -1,
"prohibitRollback": false,
"runTime": 1,
"seriesId": 3,
"startTime": "2021-08-25T15:09:32.688+08:00",
"status": "SUCCESSFUL",
"timeout": 60,
"upstreams": []
}
],
"taskDefinitionId": -1,
"type": "MANUAL",
"tags": [
{
"deleted": true,
"hostId": 1,
"objectType": "HOST",
"svrIp": "xxx.xxx.xxx.xxx"
}
],
},
"duration": 55,
"server": "a83ad33525",
"status": 200,
"successful": true,
"timestamp": "2021-08-25T15:10:13.176+08:00",
"traceId": "0bc49000675d41af"
}