Feature description
Queries the task list and supports filtering based on different parameters.
Call instructions
Interface constraints
The caller must have the TASK_VIEWER permission.
Request path
GET /api/v2/tasks/instances
Request parameters
body:
Parameter |
Type |
Required |
Example Value |
Description |
|---|---|---|---|---|
| name | String | No | Prepare host | The name of the task to search for, supports fuzzy matching. |
| status | StringArray | No | RUNNING,FAILED | The execution status of the task. Valid values: |
| type | String | No | MANUAL | The type of the task. Valid values: |
| cluterName | String | No | meta | The name of the cluster to search for, supports fuzzy matching. |
| clusterId | Long | No | 100 | The ID of the cluster. |
| tenantName | String | No | SYS | The name of the tenant, which must be used in combination with the cluster ID. |
| tenantId | Long | No | 100 | The ID of the tenant. |
| hostId | Long | No | 100 | The ID of the host. |
| page | Integer | No | 1 | The page number for pagination, which starts from 1. |
| size | Integer | No | 10 | The number of records to be returned on each page. The default value is 10, and the maximum value is 2000. |
| sort | String | No | id,asc | The sorting rule for the request data. |
Returned result
Basic data structure
Parameter |
Type |
Description |
|---|---|---|
| data | Object | The requested data. |
| ├─ contents | Array | An array of BasicTaskInstance objects. For more information, see BasicTaskInstance data structure. |
| ├─ page | Object | Paging information. For more information, see page parameter description. |
| successful | Boolean | Indicates whether the request was successful. |
| timestamp | Datetime | The server timestamp when the request was completed. |
| duration | Integer | The time taken by the server to process the request, in milliseconds. |
| status | Integer | An HTTP status code that conforms to the HTTP status specification. |
| traceId | String | The trace ID of the request, which is used to troubleshoot issues. |
| server | String | The address of the application service that responded to the request. |
BasicTaskInstance data structure
Parameter |
Type |
Description |
|---|---|---|
| id | Integer | The ID of the software package. |
| name | String | The name of the software package. |
| cluster | Object | The cluster information. For more information, see cluster parameter description. |
| tenant | Object | The tenant information. For more information, see tenant parameter description. |
| creator | Object | The information about the task creator. For more information, see creator parameter description. |
| status | Integer | The execution status of the task. Valid values: |
| startTime | String | The start time of the task. |
| finishTime | String | The end time of the task. |
| subtasks | ObjectArray | An array of BasicSubtaskInstance objects. For more information, see BasicSubtaskInstance data structure. |
| tags | Array | The list of tags. For more information, see InstanceFullTag data structure. |
| operation | String | The operation performed on the task. Valid values: execute, retry, and rollback. |
cluster parameter description
Parameter |
Type |
Description |
|---|---|---|
| id | Long | The ID of the cluster in the OCP console. |
| name | String | The name of the cluster. |
| obClusterId | Long | The ID of the cluster in OceanBase Database. |
| type | String | The cluster type. Valid values: |
tenant parameter description
Parameter |
Type |
Description |
|---|---|---|
| id | Long | The ID of the tenant in the OCP console. |
| name | String | The name of the tenant. |
| obClusterId | Long | The ID of the tenant in OceanBase Database. |
| mode | String | The tenant mode. Valid values: |
creator parameter description
Parameter |
Type |
Description |
|---|---|---|
| id | Long | The ID of the creator. |
| name | String | The username of the creator. |
BasicSubtaskInstance data structure
Parameter |
Type |
Description |
|---|---|---|
| id | Long | The ID of the subtask instance. |
| name | String | The name of the subtask. |
| description | String | The description of the subtask. |
| status | String | The status of the subtask. Valid values: |
| operation | String | The operation performed on the subtask. Valid values: |
InstanceFullTag data structure
Parameter |
Type |
Description |
|---|---|---|
| clusterName | String | The name of the cluster. |
| clusterId | Long | The ID of the cluster in the OCP console. |
| obClusterId | Long | The ID of the cluster in OceanBase Database. |
| clusterType | String | The cluster type. Valid values: |
| zoneName | String | The name of the zone. |
| tenantName | String | The name of the tenant. |
| tenantId | Long | The ID of the tenant in the OCP console. |
| obTenantId | Long | The ID of the tenant in OceanBase Database. |
| tenantMode | String | The tenant mode. Valid values: |
| tenantRole | String | The tenant role. Valid values: |
| obVersion | String | The version of OceanBase Database. |
| serverId | Long | The ID of the OBServer node. |
| arbitrationServiceId | Long | The ID of the arbitration service. |
| arbitrationServiceGroupName | String | The name of the arbitration service group. |
| arbitrationServiceGroupId | Long | The ID of the arbitration service group. |
| arbitrationServiceSvrPort | Integer | The port number of the arbitration service. |
| obproxyClusterName | String | The name of the OBProxy cluster. |
| obproxyClusterId | Long | The ID of the OBProxy cluster. |
| obproxyServerId | Long | The ID of the OBProxy server. |
| hostId | Long | The ID of the host. |
| svrIp | Long | The IP address of the host. |
| objectType | String | The type of the object associated with the task. |
| deleted | Boolean | Specifies whether the information associated with the task has been deleted. |
| binlogClusterName | String | The name of the Binlog cluster. |
| binlogClusterId | Long | The ID of the Binlog cluster. |
| binlogServerId | Long | The ID of the Binlog server. |
| tenantBinlogServiceId | Long | The ID of the Binlog instance. |
| binlogInstanceName | String | The name of the Binlog instance. |
page parameter description
Parameter |
Type |
Description |
|---|---|---|
| totalElements | Integer | The total number of records. |
| totalPages | Integer | The total number of pages. |
| number | Integer | The current page number. |
| size | Integer | The size of the current page. |
Example
Request example
GET /api/v2/tasks/instances
Response example
{
"data": {
"contents": [
{
"cluster": {
"id": 1,
"name": "ob20daily.xiaojun.chengxj",
"obClusterId": 1,
"type": "PRIMARY"
},
"creator": {
"id": 200,
"name": "system"
},
"finishTime": "2021-08-12T13:40:09.573+08:00",
"id": 6202983,
"name": "Prepare tenant",
"startTime": "2021-08-06T17:37:58.01+08:00",
"status": "SUCCESSFUL",
"operation": "execute",
"tags": [
{
"clusterId": 1,
"clusterName": "ob20daily.xiaojun.chengxj",
"clusterType": "PRIMARY",
"deleted": false,
"obClusterId": 1,
"obVersion": "4.2.5.3"
}
],
"subtasks": [
{
"description": "Set whitelist",
"id": 9009988,
"name": "Set whitelist",
"operation": "EXECUTE",
"status": "PENDING"
},
{
"description": "Update tenant status",
"id": 9009989,
"name": "Update tenant status",
"operation": "EXECUTE",
"status": "PENDING"
},
{
"description": "Set super user password",
"id": 9009987,
"name": "Set super user password",
"operation": "ROLLBACK",
"status": "PENDING"
}
],
"tenant": {
"id": 169,
"mode": "ORACLE",
"name": "zhiqiong",
"obTenantId": 1584
}
},
{
"cluster": {
"id": 1,
"name": "ob20daily.xiaojun.chengxj",
"obClusterId": 1,
"type": "PRIMARY"
},
"creator": {
"id": 100,
"name": "admin"
},
"finishTime": "2021-08-04T19:19:05.158+08:00",
"id": 6175879,
"name": "Generate workload report",
"startTime": "2021-08-04T19:14:08.512+08:00",
"status": "SUCCESSFUL",
"subtasks": [
{
"description": "Wait node",
"id": 8976786,
"name": "Wait node",
"operation": "EXECUTE",
"status": "SUCCESSFUL"
},
{
"description": "Store workload report",
"id": 8976793,
"name": "Store workload report",
"operation": "EXECUTE",
"status": "SUCCESSFUL"
},
{
"description": "Generate report",
"id": 8976785,
"name": "Generate report",
"operation": "EXECUTE",
"status": "SUCCESSFUL"
},
{
"description": "Generate report",
"id": 8976783,
"name": "Generate report",
"operation": "EXECUTE",
"status": "SUCCESSFUL"
},
{
"description": "Generate report",
"id": 8976790,
"name": "Generate report",
"operation": "EXECUTE",
"status": "SUCCESSFUL"
},
{
"description": "Generate report",
"id": 8976789,
"name": "Generate report",
"operation": "EXECUTE",
"status": "SUCCESSFUL"
}
]
}
],
"page": {
"number": 1,
"size": 10,
"totalElements": 2,
"totalPages": 1
}
},
"duration": 95,
"server": "a83ad33525",
"status": 200,
"successful": true,
"timestamp": "2021-08-25T14:30:27.27+08:00",
"traceId": "2592dcf6c88f41bf"
}
