Queries the execution results of one or more Cloud Assistant commands, that is, the actual execution results on ECS instances.
Operation description
Operation description
-
After you execute a command, the command is not guaranteed to succeed or produce the expected results. Call this operation to view the actual execution results, which are based on the actual output.
-
You can query execution information from the last 30 days. A maximum of 10,000 records of execution information can be retained.
-
You can subscribe to Cloud Assistant task status events to obtain task results through events, avoiding frequent polling and improving efficiency.
-
When querying the first page of a paging query, set only
MaxResultsto limit the number of entries returned. TheNextTokenvalue returned in the result serves as the credential for querying subsequent pages. When querying subsequent pages, setNextTokento the value obtained from the previous response and setMaxResultsto limit the number of entries returned. -
Differences between
DescribeInvocationsandDescribeInvocationResults:- When a single
RunCommand/InvokeCommandcall specifies multiple instances:DescribeInvocationsreturns the execution status on each instance and the aggregation status across multiple instances.DescribeInvocationResultsreturns only the individual execution status on each instance, without the aggregation status across multiple instances.
- When a single
RunCommand/InvokeCommandcall specifies one instance:DescribeInvocationsandDescribeInvocationResultsare largely interchangeable. You can replace one with the other.
When you need to view the execution details of scheduled (periodic) tasks or tasks that execute at each system startup (
RepeatMode=Period, EveryReboot), onlyDescribeInvocationResultscan return the history of past execution records (you must specifyIncludeHistory=true).DescribeInvocationsreturns only the latest task status.When you need to view the command content or 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 ID of the resource group to which the command execution belongs. After you specify this parameter, you must also specify ResourceGroupId when running the command. This parameter filters the corresponding command execution results. |
rg-bp67acfmxazb4p**** |
| RegionId |
string |
Yes |
地域 ID。您可以调用 DescribeRegions 查看最新的阿里云地域列表。 |
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 history records of scheduled command executions. Valid values:
Default value: false. |
false |
| ContentEncoding |
string |
No |
The encoding type of the CommandContent and Output fields in the response. Valid values:
Default value: Base64. |
PlainText |
| PageNumber |
integer |
No |
Note
This parameter is about to be deprecated. Use NextToken and MaxResults to complete paging query operations. |
1 |
| PageSize |
integer |
No |
Note
This parameter is about to be deprecated. Use NextToken and MaxResults to complete paging query operations. |
1 |
| MaxResults |
integer |
No |
The maximum number of entries per page for 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 resource count with this tag cannot exceed 1,000. If you use multiple tags to filter resources, the resource count with all specified tags attached cannot exceed 1,000. If the resource count 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 in the paging query. |
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 maximum number of entries per page. Valid values: 1 to 50. Default value: 10. |
|
|
array<object> |
|||
| Dropped |
integer |
The pagination token that is used in the next request to retrieve a new page of results. You do not need to specify this parameter for the first request. You must specify the token that is obtained from the previous query as the value of NextToken. |
0 |
| OssOutputDelivery |
string |
The tags of the command task. |
oss://testBucket/testPrefix |
| InvocationStatus |
string |
The tag of the command task. |
Success |
| InstanceId |
string |
The value of tag N of the command task. 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 |
i-bp1i7gg30r52z2em**** |
| ExitCode |
integer |
The key of tag N of the command task. Valid values of N: 1 to 20. The tag key cannot be an empty string. If a single tag is specified to query resources, up to 1,000 resources that have this tag added can be displayed in the response. If multiple tags are specified to query resources, up to 1,000 resources that have all these tags added can be displayed in the response. To query more than 1,000 resources that have specified tags added, call the ListTagResources operation. The tag key can be up to 64 characters in length and cannot start with |
0 |
| ErrorInfo |
string |
The ID of the request. |
the specified instance does not exists |
| StartTime |
string |
Details about the execution results. |
2019-12-20T06:15:55Z |
| Repeats |
integer |
The number of entries per page. |
0 |
| InvokeRecordStatus |
string |
The page number. |
Running |
| FinishedTime |
string |
The total number of the commands. |
2019-12-20T06:15:56Z |
| OssOutputUri |
string |
A pagination token. It can be used in the next request to retrieve a new page of results. |
oss://testBucket/testPrefix/output.txt |
| OssOutputStatus |
string |
The execution results. |
Finished |
| OssOutputErrorCode |
string |
The error code when delivery fails. This field is returned only when OssOutputStatus is Failed.
|
CloudAssistant.UnsupportedInvocationStatus |
| OssOutputErrorInfo |
string |
The error details when delivery fails. This field is returned only when OssOutputStatus is Failed. |
The invocation status does not support output delivery. |
| Username |
string |
The size of the Output text that was truncated and discarded because the |
test |
| ContainerId |
string |
Command to execute the Output OSS delivery configuration. |
ab141ddfbacfe02d9dbc25966ed971536124527097398d419a6746873fea**** |
| ContainerName |
string |
The execution status on a single instance. Valid values:
|
test-container |
| Output |
string |
The instance ID. |
MTU6MzA6MDEK |
| Launcher |
string |
The exit code of the command task.
|
python3 -u {{ACS::ScriptFileName|Ext(".py")}} |
| CommandId |
string |
The error message returned when the command failed to be sent or run. Valid values:
|
c-hz0jdfwcsr**** |
| ErrorCode |
string |
The time when the command started to be run on the instance. |
InstanceNotExists |
| InvokeId |
string |
The number of times that the command was run on the instance.
|
t-hz0jdfwd9f**** |
| TerminationMode |
string |
The execution status of the command. Valid values:
|
ProcessTree |
| Tags |
object |
||
| Tag |
array<object> |
The time when the command task was completed. If the command task times out, the end time is equal to the start time of the command task specified by |
|
|
object |
The command execution Output delivers the object URI to OSS. This field is an empty string when the delivery fails or is in progress. |
||
| TagKey |
string |
The output delivery status of the command execution. Valid values:
|
owner |
| TagValue |
string |
The username used to run the command on the instance. |
zhangsan |
| StopTime |
string |
root |
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.