Historical records
Updated at:2025-10-20
Query Execution History Details
Query details of a specific command execution record or file uploading record.
Request parameters
| Parameter name | Types | Required or not | Description |
|---|---|---|---|
| id | String | Yes | Execution ID |
| pageNo | int | No | Response with the page No. of sub-execution records, and the default value is 1 |
| pageSize | int | No | Response with the sub-execution record page size, the default value is 10, and the maximum is 100 |
| childRunState | String | No | Filter records of sub-executions based on their statuses. Possible values: FAILED (execution failed), RUNNING (execution ongoing), SUCCESS (execution completed). |
Response parameters
| Parameter name | Types | Description |
|---|---|---|
| requestId | String | Execution details |
| code | String | Response state, where successful execution is indicated by success. |
| result | ActionRun | Execution details |
Request example
Python
1from baidubce.auth.bce_credentials import BceCredentials
2from baidubce.bce_client_configuration import BceClientConfiguration
3from baidubce.services.ca import ca_client, ca_model
4if __name__ == '__main__':
5 HOST = b'http://ca.bj.baidubce.com'
6 AK = b''
7 SK = b''
8 config = BceClientConfiguration(credentials=BceCredentials(AK, SK),
9 endpoint=HOST)
10 ca_client = CaClient(config)
11 user_id = ''
12 id = 'r-raUPWwr933Liqe54'
13 response = ca_client.get_action_run(id, user_id)
14 print(response)
Response example
JSON
1{
2 "requestId": "8b051243-0760-4776-b8b5-024309******",
3 "code": "success",
4 "result": {
5 "id": "r-N0UrpENajU******",
6 "state": "SUCCESS",
7 "action": {
8 "type": "COMMAND",
9 "name": "auto_run_1711100283",
10 "description": "",
11 "timeoutSecond": 300,
12 "command": {
13 "type": "SHELL",
14 "content": "echo 'hello world'",
15 "scope": "INDIVIDUAL",
16 "enableParameter": false,
17 "workDir": "/",
18 "execParams": {
19 "name": "value"
20 },
21 "user": "root"
22 },
23 "createdTimestamp": 1711100284000,
24 "updatedTimestamp": 1711100316000
25 },
26 "createdTimestamp": 1711100286000,
27 "finishedTimestamp": 1711100286000,
28 "children": [
29 {
30 "id": "d-vVnBql******",
31 "state": "SUCCESS",
32 "target": {
33 "instanceId": "i-mfIg****",
34 "instanceType": "BCC",
35 },
36 "createdTimestamp": 1711100286503,
37 "finishedTimestamp": 1711100286576,
38 "output": {
39 "exitCode": 0,
40 "stderr": "",
41 "stdout": "hello world\n",
42 "isTruncated": false
43 }
44 }
45 ],
46 "totalCount": 1
47 }
48}
Query execution record list
Query list of command execution record or file uploading record.
Request parameters
| Parameter name | Types | Required or not | Description |
|---|---|---|---|
| action | RunFilter | Yes | Execution record filter |
| pageNo | int | Yes | Page No. |
| pageSize | int | Yes | Page size |
| ascending | bool | No | Is it sorted by execution start time in ascending order? It is false by default. |
| state | string | No | Filter records by execution status. Possible values: FAILED (execution failed), RUNNING (execution ongoing), SUCCESS (execution completed). |
| runId | string | No | Filter by execution ID |
| startTime | long | No | Filter records using timestamps in Unix format (milliseconds). Execution start time should be greater than or equal to endTime (Unix timestamp, milliseconds). |
| endTime | long | No | Filter records using timestamps in Unix format (milliseconds). Execution start time should be greater than or equal to endTime (Unix timestamp, milliseconds). |
RunFilter
| Parameter name | Types | Required or not | Parameter location | Description |
|---|---|---|---|---|
| type | string | Yes | RequestBody | Type of execution record. Possible values: COMMAND (command execution records), FILE_UPLOAD (file upload records). |
| id | string | No | RequestBody | Filter by command ID, valid only for command execution records |
| name | string | No | RequestBody | Filter by command name, valid only for command execution records |
| fileUpload | FileUploadFilter | No | RequestBody | Filter command uploading records |
FileUploadFilter
| Parameter name | Types | Required or not | Parameter location | Description |
|---|---|---|---|---|
| filename | string | Yes | RequestBody | Filter by uploaded file name |
Response headers
There are no special headers required beyond the common headers.
Response parameters
| Parameter name | Types | Description |
|---|---|---|
| requestId | String | Execution details |
| code | String | Response state, where successful execution is indicated by success. |
| result | List<ActionRun> | Execution details |
Request example
Python
1from baidubce.auth.bce_credentials import BceCredentials
2from baidubce.bce_client_configuration import BceClientConfiguration
3from baidubce.services.ca import ca_client, ca_model
4if __name__ == '__main__':
5 HOST = b'http://ca.bj.baidubce.com'
6 AK = b''
7 SK = b''
8 config = BceClientConfiguration(credentials=BceCredentials(AK, SK),
9 endpoint=HOST)
10 ca_client = CaClient(config)
11 action = ca_model.Action(
12 "", "", "COMMAND"
13 )
14 ascending = False
15 page_no = 1
16 page_size = 10
17 sort = "createTime"
18 user_id = ""
19 response = ca_client.action_run_list(action, page_no, page_size, sort, ascending, user_id)
20 self.assertEqual(type(response), baidubce.bce_response.BceResponse)
21 print(response)
Response example
JSON
1{
2 "requestId": "f5c8cbf2-b66b-4894-b98d-dae6cb******",
3 "code": "success",
4 "result": {
5 "pageNo": 1,
6 "pageSize": 10,
7 "totalCount": 2,
8 "data": [
9 {
10 "id": "r-QWR6CCMVj0******",
11 "state": "SUCCESS",
12 "action": {
13 "type": "COMMAND",
14 "timeoutSecond": 60,
15 "command": {
16 "type": "SHELL",
17 "content": "ls",
18 "scope": "INDIVIDUAL",
19 "enableParameter": false,
20 "workDir": "/home",
21 "user": "root"
22 }
23 },
24 "createdTimestamp": 1710837417000,
25 "finishedTimestamp": 1710837419000,
26 "statistics": {
27 "totalTargetCount": 1,
28 "failedTargetCount": 0
29 }
30 },
31 {
32 "id": "r-vufYpbTTyd******",
33 "state": "SUCCESS",
34 "action": {
35 "id": "c-5iEoMgGqXL******",
36 "type": "COMMAND",
37 "name": "auto_test_1709896691",
38 "description": "",
39 "timeoutSecond": 300,
40 "command": {
41 "type": "SHELL",
42 "content": "echo 'hello world'",
43 "scope": "INDIVIDUAL",
44 "enableParameter": false,
45 "workDir": "/",
46 "user": "root"
47 }
48 },
49 "createdTimestamp": 1709896693000,
50 "finishedTimestamp": 1709896697000,
51 "statistics": {
52 "totalTargetCount": 1,
53 "failedTargetCount": 0
54 }
55 }
56 ]
57 }
58}
Appendix
ActionRun
| Parameter name | Types | Description |
|---|---|---|
| id | String | Execution ID |
| action | [Action](BCC/Cloud Assistant API Reference/Command Interface.md#Action) | Details of executed action |
| state | String | Execution status. Possible values: FAILED (execution failed), RUNNING (execution ongoing), SUCCESS (execution completed), PARTIAL_FAILED (partially failed). |
| createdTimestamp | long | Execution start time in Unix timestamp format, measured in milliseconds. |
| finishedTimestamp | long | Execution end time, available only after the execution is completed. Unix timestamp format, measured in milliseconds. |
| statistics | Statistics | Sub-execution state, responded only when querying the execution record list |
ChildRun
| Parameter name | Types | Description |
|---|---|---|
| id | String | Sub-execution ID |
| state | String | Execution status. Possible values: FAILED (execution failed), RUNNING (execution ongoing), SUCCESS (execution completed). |
| createdTimestamp | long | Start time for sub-execution, in Unix timestamp format (milliseconds). |
| finishedTimestamp | long | End time for sub-execution, available only after it is completed. Unix timestamp format (milliseconds). |
| failReason | String | Reasons for sub-execution failure |
| output | Output | Command output result |
| Target | [Target](BCC/Cloud Assistant API Reference/Command Interface.md#Target) | Instance information corresponding to sub-execution |
Output
| Parameter name | Types | Description |
|---|---|---|
| exitCode | int | Exit code |
| stdout | String | Standard output |
| stderr | String | Standard error |
| isTruncated | bool | The standard output or standard error is truncated due to excessive length (exceeding 4KB) |
Statistics
| Parameter name | Types | Description |
|---|---|---|
| totalTargetCount | int | Total count of executed instances |
| failedTargetCount | int | Total count of failed instances |
