Description
You can call this operation to query tasks by different parameters.
Call description
Prerequisite
You have the TASK_VIEWER permissions.
Request path
GET /api/v2/tasks/instances
Request parameters
| Parameter | Type | Required | Example value | Description |
|---|---|---|---|---|
| name | String | No | Prepare host | The keyword in the name of the task. Fuzzy match is supported. |
| status | StringArray | No | RUNNING,FAILED | The status of the task. Valid values: * RUNNING * FAILED * SUCCESSFUL |
| type | String | No | MANUAL | The type of the task. Valid values: * MANUAL: indicates a manually initiated task. * SYS_ONECE: indicates a one-time task executed by the system. * SCHEDULED: indicates a non-built-in scheduled task. * SYS_SCHEDULED: indicates a built-in scheduled task. |
| cluterName | String | No | meta | The keyword in the name of the cluster. Fuzzy match is supported. |
| clusterId | Long | No | 100 | The ID of the cluster. |
| tenantName | String | No | SYS | The name of the tenant, which must be used with the ID of the cluster. |
| tenantId | Long | No | 100 | The ID of the tenant. |
| hostId | Long | No | 100 | The ID of the host. |
| page | Integer | No | 1 | The number of the page to return. Pages start from page 1. |
| size | Integer | No | 10 | The number of entries to return on each page. Maximum value: 2000. |
| sort | String | No | id,asc | The rule for sorting the requested data. |
Response parameters
| Parameter | Type | Description |
|---|---|---|
| data | Object | The requested data. |
| ├─ contents | Array | The BasicTaskInstance array. For more information about the data structure, see the following table. |
| ├─ page | Object | The page information. For more information, see the page parameters. |
| successful | Boolean | Indicates whether the request was successful. |
| timestamp | Datetime | The timestamp when the server completed the request. |
| duration | Integer | The time taken by the server to process the request, in milliseconds. |
| status | Integer | An HTTP status code. |
| traceId | String | The trace ID of the request. This trace ID is used for troubleshooting. |
| server | String | The address of the application server that responded to the request. |
Page parameters
| Parameter | Type | Description |
|---|---|---|
| totalElements | Integer | The total number of entries. |
| totalPage | Integer | The total number of pages. |
| number | Integer | The page number of the returned page. |
| size | Integer | The number of entries returned per page. |
Data structure of BasicTaskInstance
| Parameter | Type | Description |
|---|---|---|
| id | Integer | The ID of the software package. |
| name | String | The name of the software package. |
| ├─ cluster | Object | The cluster information. |
| ├─ tenant | Object | The tenant information. |
| ├─ creator | Object | The information about the task creator. |
| status | Integer | The status of the task. Valid values: * RUNNING * FAILED * SUCCESSFUL |
| startTime | String | The start time of the task. |
| finishTime | String | The end time of the task. |
| subtasks | ObjectArray | The BasicSubtaskInstance array, which contains the information of all subtasks. |
Cluster parameters
| Parameter | Type | Description |
|---|---|---|
| id | Long | The ID of the OceanBase cluster generated by the OCP system. |
| name | String | The name of the OceanBase cluster. |
| obClusterId | Long | The ID of the OceanBase cluster generated by the OceanBase Database system. |
| type | String | The type of the OceanBase cluster. Valid values: * PRIMARY * STANDBY |
Tenant parameters
| Parameter | Type | Description |
|---|---|---|
| id | Long | The ID of the tenant generated by the OCP system. |
| name | String | The name of the tenant. |
| obTenantId | Long | The ID of the tenant generated by the OceanBase Database system. |
| mode | String | The mode of the tenant. Valid values: * ORACLE * MYSQL |
Creator parameters
| Parameter | Type | Description |
|---|---|---|
| id | Long | The ID of the creator. |
| name | String | The username of the creator. |
Data structure of BasicSubtaskInstance
| 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: * PENDING * READY * RUNNING * CANCELING * FAILED * SUCCESSFUL |
| operation | String | The operation performed by the subtask. Valid values: * EXECUTE * RETRY * ROLLBACK * SKIP * CANCEL |
Examples
Sample request
GET /api/v2/tasks/instances
Sample response
{
"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",
"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"
}