DescribeInvocationResults
Queries the execution results of one or more Cloud Assistant commands on ECS instances.
Operation description
Operation description
-
After you run a command, the command may not be executed successfully or produce the expected results. You must call this operation to check the actual execution results. The actual output prevails.
-
You can query the execution information of the last 30 days. A maximum of 10,000 execution records are retained.
-
You can subscribe to Cloud Assistant task status events to obtain task results through events. This prevents frequent polling and improves efficiency.
-
When paged query the first page, you only need to set
MaxResultsto limit the number of returned entries. TheNextTokenvalue in the response is used as the token to query the next page. When paged query the next page, set theNextTokenparameter to theNextTokenvalue obtained from the previous response, and setMaxResultsto limit the number of returned entries. -
Differences between
DescribeInvocationsandDescribeInvocationResults:- When a
RunCommandorInvokeCommandcall specifies multiple instances:You can use
DescribeInvocationsto obtain the execution status of the task on each instance and the aggregated status of the task across multiple instances.You can use
DescribeInvocationResultsto obtain only the individual execution status on each instance. The aggregated status across multiple instances is not included.
- When a
RunCommandorInvokeCommandcall specifies a single instance:DescribeInvocationsandDescribeInvocationResultshave little difference and can be used interchangeably.
When you need to view each execution record of a scheduled task or a task that runs automatically on startup (
RepeatMode=Period, EveryReboot), you can only useDescribeInvocationResultsto query the historical execution records (you must specifyIncludeHistory=true).DescribeInvocationsreturns only the latest task status.When you need to view the command content and parameters, only
DescribeInvocationsreturnsCommandContent.
- When a
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 the DescribeRegions operation to query the most recent region list. |
cn-hangzhou |
| ResourceGroupId |
string |
No |
The ID of the resource group to which the command execution belongs. If you specify this parameter, you must also specify ResourceGroupId when you run the command. This allows you to filter the corresponding command execution results. |
rg-bp67acfmxazb4p**** |
| InvokeId |
string |
No |
The execution ID of the command. You can call the DescribeInvocations operation to query the execution ID. |
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 historical records of scheduled command executions. Valid values:
Default value: false. |
false |
| ContentEncoding |
string |
No |
The encoding format of the
Default value: Base64. |
PlainText |
| PageNumber |
integer |
No |
Note
This parameter will soon be deprecated. We recommend that you use NextToken and MaxResults to perform paging queries. |
1 |
| PageSize |
integer |
No |
Note
This parameter will soon be deprecated. We recommend that you use NextToken and MaxResults to perform paging queries. |
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 the value to the NextToken value returned from the previous API call. |
AAAAAdDWBF2 |
| Tag |
array<object> |
No |
The list of tags. |
|
|
object |
No |
The list of tags. |
||
| Value |
string |
No |
The tag value of the command execution. Valid values of N: 1 to 20. The 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 to execute. Valid values of N: 1 to 20. The value cannot be an empty string. If you use a single tag to filter resources, the resource count under this tag cannot exceed 1,000. If you use multiple tags to filter resources, the resource count of resources that have multiple tags attached cannot exceed 1,000. If the resource count exceeds 1,000, you must call the ListTagResources operation to query the resources. 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 rows per page in a paging query. |
1 |
| PageNumber |
integer |
The current page number. |
1 |
| TotalCount |
integer |
The total number of commands. Note
If you use the MaxResults and NextToken parameters for a paging query, the returned TotalCount value is meaningless. |
1 |
| NextToken |
string |
The pagination token returned by the current call. |
AAAAAdDWBF2 |
| InvocationResults |
object |
||
| InvocationResult |
array<object> |
The collection of command execution results. |
|
|
array<object> |
|||
| Dropped |
integer |
The length of the text that is truncated and discarded when the text length in the |
0 |
| OssOutputDelivery |
string |
The OSS delivery configuration for the command execution output. |
oss://testBucket/testPrefix |
| InvocationStatus |
string |
The execution status of the command 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 about the cause 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 run on the instance. The time is displayed in ISO 8601 format in UTC. |
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 completed. If the command execution times out, the completion time is calculated by adding the |
2019-12-20T06:15:56Z |
| OssOutputUri |
string |
The URI of the file to which the command execution output is delivered in OSS. If the delivery fails or is in progress, this field is an empty string. |
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 parameter is returned only when OssOutputStatus is set to Failed. Valid values:
|
CloudAssistant.UnsupportedInvocationStatus |
| OssOutputErrorInfo |
string |
The error details returned when the delivery fails. This parameter is returned only when OssOutputStatus is Failed. |
The invocation status does not support output delivery. |
| Username |
string |
The username of the user who runs the command on the ECS instance. |
test |
| ContainerId |
string |
The container ID. |
ab141ddfbacfe02d9dbc25966ed971536124527097398d419a6746873fea**** |
| ContainerName |
string |
The container name. |
test-container |
| Output |
string |
The output information after the command is executed.
|
MTU6MzA6MDEK |
| Launcher |
string |
The bootstrap program for script execution. The length cannot exceed 1 KB. |
python3 -u {{ACS::ScriptFileName|Ext(".py")}} |
| CommandId |
string |
The command ID. |
c-hz0jdfwcsr**** |
| ErrorCode |
string |
The error code for the cause of the command delivery failure or execution failure. Valid values:
|
InstanceNotExists |
| InvokeId |
string |
The execution ID of the command. |
t-hz0jdfwd9f**** |
| TerminationMode |
string |
The mode used when the task is stopped, either manually or due to an execution 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 the |
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 | InvalidParameterCharacter | The specified parameter %s contains illegal characters. | |
| 403 | Operation.Forbidden | The operation is not permitted. | The operation is not supported. |
| 403 | RequestDenied.WAFIntercepted | Request denied by WAF security protection. | The request is blocked by WAF security protection. |
| 404 | InvalidRegionId.NotFound | The RegionId provided does not exist in our records. | Region information error |
| 404 | InvalidCommandId.NotFound | The specified commandId does not exist |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.