Queries the execution results of one or more Cloud Assistant commands, which are the actual execution results on ECS instances.
Operation description
Operation description
-
After you run a command, the command is not guaranteed to succeed or produce the expected results. Call this operation to view the actual execution results based on the actual output.
-
You can query execution information from the last 30 days. A maximum of 10,000 entries of execution information can be retained.
-
You can use Cloud Assistant task status event subscription to obtain task results through events, which avoids frequent polling and improves efficiency.
-
When paged query the first page, set only MaxResults to limit the number of entries to return. The NextToken value in the response serves as the token for querying subsequent pages. When paged query subsequent pages, set NextToken to the NextToken value obtained from the previous response and set MaxResults to limit the number of entries to return.
-
Differences between
DescribeInvocationsandDescribeInvocationResults:- When a single
RunCommand/InvokeCommandcall specifies multiple instances:DescribeInvocationsreturns the execution status on each instance and the aggregated status across all instances.DescribeInvocationResultsreturns only the individual execution status on each instance, without the aggregated status across instances.
- When a single
RunCommand/InvokeCommandcall specifies one instance:DescribeInvocationsandDescribeInvocationResultsare largely interchangeable.
When you want to view the execution history of scheduled (periodic) tasks or tasks that run at each system startup (
RepeatMode=Period, EveryReboot), onlyDescribeInvocationResultscan return historical execution records (you must specifyIncludeHistory=true).DescribeInvocationsreturns only the latest task status.When you want to view the command content and parameters, only
DescribeInvocationsreturnsCommandContent.
- When a single
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
ecs:DescribeInvocationResults |
get |
Command
Instance
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
Yes |
The region ID. You can call DescribeRegions to query the most recent region list. |
cn-hangzhou |
| ResourceGroupId |
string |
No |
The resource group ID of the command execution. After you specify this parameter, the resource group ID must also be specified when you run the command. This parameter filters the corresponding command execution results. |
rg-bp67acfmxazb4p**** |
| RegionId |
string |
Yes |
The region ID. You can call DescribeRegions to query the most recent region list. |
cn-hangzhou |
| InvokeId |
string |
No |
The command execution ID. You can call DescribeInvocations to query the InvokeId. |
t-hz0jdfwd9f**** |
| InstanceId |
string |
No |
The instance ID. |
i-bp1i7gg30r52z2em**** |
| CommandId |
string |
No |
The command ID. |
c-hz0jdfwcsr**** |
| InvokeRecordStatus |
string |
No |
The execution status of the command. Valid values:
|
Running |
| IncludeHistory |
boolean |
No |
Specifies whether to return the execution history of scheduled commands. Valid values:
Default value: false. |
false |
| ContentEncoding |
string |
No |
The encoding method of the
Default value: Base64. |
PlainText |
| PageNumber |
integer |
No |
Note
This parameter is about to go offline. Use NextToken and MaxResults to complete paging query operations. |
1 |
| PageSize |
integer |
No |
Note
This parameter is about to go offline. Use NextToken and MaxResults to complete paging query operations. |
1 |
| MaxResults |
integer |
No |
The maximum number of entries per page in a paging query. Maximum value: 50. Default value: 10. |
10 |
| NextToken |
string |
No |
The pagination token. Set this parameter to the NextToken value returned in the previous API call. |
AAAAAdDWBF2 |
| Tag |
array<object> |
No |
The tags. |
|
|
object |
No |
The tags. |
||
| Value |
string |
No |
The tag value of the command execution. Valid values of N: 1 to 20. The tag value can be an empty string. The tag value can be up to 128 characters in length and cannot contain |
TestValue |
| Key |
string |
No |
The tag key of the command execution. Valid values of N: 1 to 20. The tag key cannot be an empty string. If you use a single tag to filter resources, the number of resources with this tag cannot exceed 1,000. If you use multiple tags to filter resources, the number of resources with all specified tags attached cannot exceed 1,000. If the number of resources exceeds 1,000, call ListTagResources to execute the query. The tag key can be up to 64 characters in length and cannot start with |
TestKey |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The request ID. |
473469C7-AA6F-4DC5-B3DB-A3DC0DE***** |
| Invocation |
object |
The collection of command execution results. |
|
| PageSize |
integer |
The number of entries per page. This value is the PageSize value specified in the paging query settings. |
1 |
| PageNumber |
integer |
The current page number. |
1 |
| TotalCount |
integer |
The total number of commands. |
1 |
| NextToken |
string |
The pagination token returned in this call. |
AAAAAdDWBF2 |
| InvocationResults |
object |
||
| InvocationResult |
array<object> |
The command execution result set. |
|
|
array<object> |
|||
| Dropped |
integer |
The length of the truncated and discarded text after the text in the Output field exceeds 24 KB. |
0 |
| OssOutputDelivery |
string |
The OSS delivery configuration for the command execution output. |
oss://testBucket/testPrefix |
| InvocationStatus |
string |
The command execution status on a single instance. Valid values:
|
Success |
| InstanceId |
string |
The instance ID. |
i-bp1i7gg30r52z2em**** |
| ExitCode |
integer |
The exit code of the command.
|
0 |
| ErrorInfo |
string |
The details of the command delivery failure or execution failure. Valid values:
|
the specified instance does not exists |
| StartTime |
string |
The time when the command started to be executed on the instance. |
2019-12-20T06:15:55Z |
| Repeats |
integer |
The number of times the command was executed on the instance.
|
0 |
| InvokeRecordStatus |
string |
The execution status of the command. Valid values:
|
Running |
| FinishedTime |
string |
The time when the command execution was complete. If the command execution times out, the completion time is calculated as StartTime plus the timeout period Timeout. |
2019-12-20T06:15:56Z |
| OssOutputUri |
string |
The URI of the file in OSS to which the command execution output is delivered. This field is an empty string if the delivery is in progress or has failed. |
oss://testBucket/testPrefix/output.txt |
| OssOutputStatus |
string |
The delivery status of the command execution output. Valid values:
|
Finished |
| OssOutputErrorCode |
string |
The error code returned when the delivery fails. This field is returned only when OssOutputStatus is Failed. Valid values:
|
CloudAssistant.UnsupportedInvocationStatus |
| OssOutputErrorInfo |
string |
The error details returned when the delivery fails. This field is returned only when OssOutputStatus is Failed. |
The invocation status does not support output delivery. |
| Username |
string |
The username used to execute the command on the ECS instance. |
test |
| ContainerId |
string |
The container ID. |
ab141ddfbacfe02d9dbc25966ed971536124527097398d419a6746873fea**** |
| ContainerName |
string |
The container name. |
test-container |
| Output |
string |
The output of the command execution.
|
MTU6MzA6MDEK |
| Launcher |
string |
The bootstrap program for script execution. The value cannot exceed 1 KB in length. |
python3 -u {{ACS::ScriptFileName|Ext(".py")}} |
| CommandId |
string |
The command ID. |
c-hz0jdfwcsr**** |
| ErrorCode |
string |
The error code for command delivery failure or execution failure. Valid values:
|
InstanceNotExists |
| InvokeId |
string |
The command execution ID. |
t-hz0jdfwd9f**** |
| TerminationMode |
string |
The mode used when the task is stopped (manually stopped or interrupted due to timeout). Valid values:
|
ProcessTree |
| Tags |
object |
||
| Tag |
array<object> |
The tag information of the command execution. |
|
|
object |
The tag information of the command execution. |
||
| TagKey |
string |
The tag key of the command execution. |
owner |
| TagValue |
string |
The tag value of the command execution. |
zhangsan |
| StopTime |
string |
The time when StopInvocation was called to stop the command execution. |
2020-01-19T09:15:47Z |
Examples
Success response
JSON format
{
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE*****",
"Invocation": {
"PageSize": 1,
"PageNumber": 1,
"TotalCount": 1,
"NextToken": "AAAAAdDWBF2",
"InvocationResults": {
"InvocationResult": [
{
"Dropped": 0,
"OssOutputDelivery": "oss://testBucket/testPrefix",
"InvocationStatus": "Success",
"InstanceId": "i-bp1i7gg30r52z2em****",
"ExitCode": 0,
"ErrorInfo": "the specified instance does not exists",
"StartTime": "2019-12-20T06:15:55Z",
"Repeats": 0,
"InvokeRecordStatus": "Running",
"FinishedTime": "2019-12-20T06:15:56Z",
"OssOutputUri": "oss://testBucket/testPrefix/output.txt",
"OssOutputStatus": "Finished",
"OssOutputErrorCode": "CloudAssistant.UnsupportedInvocationStatus",
"OssOutputErrorInfo": "The invocation status does not support output delivery.",
"Username": "test",
"ContainerId": "ab141ddfbacfe02d9dbc25966ed971536124527097398d419a6746873fea****",
"ContainerName": "test-container",
"Output": "MTU6MzA6MDEK",
"Launcher": "python3 -u {{ACS::ScriptFileName|Ext(\".py\")}}",
"CommandId": "c-hz0jdfwcsr****",
"ErrorCode": "InstanceNotExists",
"InvokeId": "t-hz0jdfwd9f****",
"TerminationMode": "ProcessTree",
"Tags": {
"Tag": [
{
"TagKey": "owner",
"TagValue": "zhangsan"
}
]
},
"StopTime": "2020-01-19T09:15:47Z"
}
]
}
}
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | RegionId.ApiNotSupported | The api is not supported in this region. | The API operation cannot be called in the specified region. Check whether the specified RegionId parameter is valid. |
| 400 | NumberExceed.Tags | The Tags parameter number is exceed. | The number of tags exceeds the maximum limit. |
| 400 | Duplicate.TagKey | The Tag.N.Key contain duplicate key. | The specified tag key already exists. Tag keys must be unique. |
| 400 | InvalidTagKey.Malformed | The specified Tag.n.Key is not valid. | The specified Tag.N.Key parameter is invalid. |
| 400 | InvalidTagValue.Malformed | The specified Tag.n.Value is not valid. | The specified tag value is invalid. |
| 400 | MissingParameter.TagKey | You must specify Tag.N.Key. | The tag key is not specified. |
| 400 | InvalidParam.PageNumber | The specified parameter is invalid. | |
| 400 | InvalidParam.PageSize | The specified parameter is invalid. | |
| 400 | InvalidParameter.NextToken | The specified parameter NextToken is not valid. | The specified parameter NextToken is illegal. |
| 400 | InvalidParameter.MaxResults | The specified parameter MaxResults is not valid. | The specified parameter MaxResults is illegal. |
| 500 | InternalError.Dispatch | An error occurred when you dispatched the request. | An error occurred while the request is being sent. Try again later. |
| 500 | ServiceUnavailable | The request has failed due to a temporary failure of the server. | |
| 500 | InternalError | The request processing has failed due to some unknown error. | |
| 403 | Operation.Forbidden | The operation is not permitted. | The operation is not supported. |
| 404 | InvalidRegionId.NotFound | The RegionId provided does not exist in our records. | Region information error |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.