All Products
Search
Document Center

Elastic Compute Service:DescribeInvocationResults

Last Updated:Nov 20, 2023

Queries the execution results of one or more Cloud Assistant commands on Elastic Compute Service (ECS) instances.

Usage notes

  • After you run a command, the command may fail to run or may return unexpected results. You can call this operation to query the execution result of a command.

  • You can query information about command executions within the last four weeks. Up to 100,000 pieces of execution information can be retained.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter

Type

Required

Example

Description

Action

String

Yes

DescribeInvocationResults

The operation that you want to perform. Set the value to DescribeInvocationResults.

RegionId

String

Yes

cn-hangzhou

The region ID of the command. You can call the DescribeRegions operation to query the most recent region list.

ResourceGroupId

String

No

rg-bp67acfmxazb4p****

The ID of the resource group. After you set this parameter, command execution results in the specified resource group are queried.

InvokeId

String

No

t-hz0jdfwd9f****

The ID of the command task. You can call the DescribeInvocations operation to query the IDs of all command tasks.

InstanceId

String

No

i-bp1i7gg30r52z2em****

The instance ID.

CommandId

String

No

c-hz0jdfwcsr****

The command ID.

InvokeRecordStatus

String

No

Running

The state of the command task. Valid values:

  • Running:

    • Scheduled task: Before you manually stop the scheduled task, the overall execution state is always Running.

    • One-time task: If the command is being run on instances, the overall execution state is Running.

  • Finished:

    • Scheduled task: The overall execution state cannot be Finished.

    • One-time task: The execution is complete on all instances, or the execution is manually stopped on some instances and is complete on other instances.

  • Failed:

    • Scheduled task: The overall execution state cannot be Failed.

    • One-time task: The execution fails on all instances.

  • PartialFailed:

    • Scheduled task: The overall execution state cannot be PartialFailed.

    • One-time task: The execution fails on some instances.

  • Stopped: The task is stopped.

  • Stopping: The task is being stopped.

IncludeHistory

Boolean

No

false

Specifies whether to return the results of historical scheduled executions. Valid values:

  • true: returns the results of historical scheduled executions. If you set this parameter to true, you must set InvokeId to a task that is run on a schedule (RepeatMode set to Period) or on each system startup (RepeatMode set to EveryReboot).

  • false: does not return the results of historical scheduled executions.

Default value: false.

ContentEncoding

String

No

PlainText

The encoding mode of the CommandContent and Output values in the response. Valid values:

  • PlainText: returns the original command content and command output.

  • Base64: returns the Base64-encoded command content and command output.

Default value: Base64.

PageNumber

Long

No

1

The page number.

Pages start from page 1.

Default value: 1.

PageSize

Long

No

1

The number of entries per page.

Valid values: 1 to 50.

Default value: 10.

Tag.N.Key

String

No

TestKey

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, call the ListTagResources operation.

The tag key can be up to 64 characters in length and cannot start with acs: or aliyun. It cannot contain http:// or https://.

Tag.N.Value

String

No

TestValue

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 http:// or https://.

Response parameters

Parameter

Type

Example

Description

RequestId

String

473469C7-AA6F-4DC5-B3DB-A3DC0DE*****

The request ID.

Invocation

Object

Details about the execution results.

PageSize

Long

1

The number of entries per page.

PageNumber

Long

1

The page number.

TotalCount

Long

1

The total number of commands.

InvocationResults

Array of InvocationResult

The execution results.

InvocationResult

InvocationStatus

String

Success

The execution state on a single instance. Valid values:

  • Pending: The command is being verified or sent.

  • Invalid: The specified command type or parameter is invalid.

  • Aborted: The command failed to be sent. To send a command to an instance, make sure that the instance is in the Running state and the command can be sent to the instance within 1 minute.

  • Running: The command is being run on the instance.

  • Success:

    • One-time task: The execution is complete, and the exit code is 0.

    • Scheduled task: The last execution succeeds, the exit code is 0, and the specified cycle ends.

  • Failed:

    • One-time task: The execution is complete, but the exit code is not 0.

    • Scheduled task: The last execution succeeds, the exit code is not 0, and the specified cycle is about to end.

  • Error: The execution cannot proceed due to an exception.

  • Timeout: The execution timed out.

  • Cancelled: The execution is canceled, and the command is not run.

  • Stopping: The task is being stopped.

  • Terminated: The command is terminated during execution.

  • Scheduled:

    • One-time task: The execution state can never be Scheduled.

    • Scheduled task: The command is waiting to be executed.

Repeats

Integer

0

The number of times that the command was run on the instance.

  • If the command is set to run only once, the value is 0 or 1.

  • If the command is set to run on a schedule, the value is the number of times that the command was run.

CommandId

String

c-hz0jdfwcsr****

The command ID.

InstanceId

String

i-bp1i7gg30r52z2em****

The instance ID.

Output

String

MTU6MzA6MDEK

The command output.

  • If ContentEncoding is set to PlainText in the request, the original command output is returned.

  • If ContentEncoding is set to Base64 in the request, the Base64-encoded command output is returned.

Dropped

Integer

0

The size of the Output text that is truncated and discarded when the Output value exceeds 24 KB in size.

StopTime

String

2020-01-19T09:15:47Z

The time when the command task was stopped. If you call the StopInvocation operation to stop the command task, the value of this parameter is the time when the operation is called.

ExitCode

Long

0

The exit code of the command task.

  • For Linux instances, the exit code is the exit code of the shell command.

  • For Windows instances, the exit code is the exit code of the batch or PowerShell command.

StartTime

String

2019-12-20T06:15:55Z

The time when the command started to be run on the instance.

ErrorInfo

String

the specified instance does not exists

The error message returned when the command failed to be sent or run. Valid values:

  • If this parameter is left empty, the command is run normally.

  • the specified instance does not exists

  • the instance has released when create task

  • the instance is not running when create task

  • the command is not applicable

  • the specified account does not exist

  • the specified directory does not exist

  • the cron job expression is invalid

  • the aliyun service is not running on the instance

  • the aliyun service in the instance does not response

  • the aliyun service in the instance is upgrading now

  • the aliyun service in the instance need upgrade

  • the command delivery has been timeout

  • the command execution has been timeout

  • the command execution got an exception

  • the command execution has been interrupted

  • the command execution exit code is not zero

  • the specified instance has been released

ErrorCode

String

InstanceNotExists

The error code returned when the command failed to be sent or run. Valid values:

  • If this parameter is left empty, the command is run normally.

  • InstanceNotExists

  • InstanceReleased

  • InstanceNotRunning

  • CommandNotApplicable

  • AccountNotExists

  • DirectoryNotExists

  • BadCronExpression

  • ClientNotRunning

  • ClientNotResponse

  • ClientIsUpgrading

  • ClientNeedUpgrade

  • DeliveryTimeout

  • ExecutionTimeout

  • ExecutionException

  • ExecutionInterrupted

  • ExitCodeNonzero

FinishedTime

String

2019-12-20T06:15:56Z

The completion time of the command task. If the command task times out, the end time is equal to the start time of the command task specified by StartTime plus the timeout period specified by Timeout.

InvokeId

String

t-hz0jdfwd9f****

The ID of the command task.

InvokeRecordStatus

String

Running

The state of the command task. Valid values:

  • Running:

    • Scheduled task: Before you manually stop the scheduled task, the overall execution state is always Running.

    • One-time task: If the command is being run on instances, the overall execution state is Running.

  • Finished:

    • Scheduled task: The overall execution state cannot be Finished.

    • One-time task: The execution is complete on all instances, or the execution is manually stopped on some instances and is complete on other instances.

  • Failed:

    • Scheduled task: The overall execution state cannot be Failed.

    • One-time task: The execution fails on all instances.

  • PartialFailed:

    • Scheduled task: The overall execution state cannot be PartialFailed.

    • One-time task: The execution fails on some instances.

  • Stopped: The task is stopped.

  • Stopping: The task is being stopped.

Username

String

test

The username that was used to run the command on the instance.

ContainerId

String

ab141ddfbacfe02d9dbc25966ed971536124527097398d419a6746873fea****

The ID of the container.

ContainerName

String

test-container

The container name.

Tags

Array of Tag

The tag of the command task.

Tag

TagKey

String

owner

The tag key of the command task.

TagValue

String

zhangsan

The tag value of the command task.

Examples

Sample requests

http(s)://ecs.aliyuncs.com/?Action=DescribeInvocationResults
&RegionId=cn-hangzhou
&InstanceId=i-bp1i7gg30r52z2em****
&PageNumber=1
&PageSize=1
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<DescribeInvocationResultsResponse>
    <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE*****</RequestId>
    <Invocation>
        <InvocationResults>
            <InvocationResult>
                <Dropped>0</Dropped>
                <InvocationStatus>Success</InvocationStatus>
                <InstanceId>i-bp1i7gg30r52z2em****</InstanceId>
                <ExitCode>0</ExitCode>
                <ErrorInfo>the specified instance does not exists</ErrorInfo>
                <StartTime>2019-12-20T06:15:55Z</StartTime>
                <Repeats>0</Repeats>
                <InvokeRecordStatus>Running</InvokeRecordStatus>
                <FinishedTime>2019-12-20T06:15:56Z</FinishedTime>
                <Output>MTU6MzA6MDEK</Output>
                <CommandId>c-hz0jdfwcsr****</CommandId>
                <ErrorCode>InstanceNotExists</ErrorCode>
                <InvokeId>t-hz0jdfwd9f****</InvokeId>
                <StopTime>2020-01-19T09:15:47Z</StopTime>
                <Username>test</Username>
                <ContainerId>ab141ddfbacfe02d9dbc25966ed971536124527097398d419a6746873fea****</ContainerId>
                <ContainerName>test-container</ContainerName>
                <Tags>
                    <TagKey>owner</TagKey>
                    <TagValue>zhangsan</TagValue>
                </Tags>
            </InvocationResult>
        </InvocationResults>
        <TotalCount>1</TotalCount>
        <PageSize>1</PageSize>
        <PageNumber>1</PageNumber>
    </Invocation>
</DescribeInvocationResultsResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "473469C7-AA6F-4DC5-B3DB-A3DC0DE*****",
  "Invocation" : {
    "InvocationResults" : {
      "InvocationResult" : [ {
        "Dropped" : 0,
        "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",
        "Output" : "MTU6MzA6MDEK",
        "CommandId" : "c-hz0jdfwcsr****",
        "ErrorCode" : "InstanceNotExists",
        "InvokeId" : "t-hz0jdfwd9f****",
        "StopTime" : "2020-01-19T09:15:47Z",
        "Username" : "test",
        "ContainerId" : "ab141ddfbacfe02d9dbc25966ed971536124527097398d419a6746873fea****",
        "ContainerName" : "test-container",
        "Tags" : [ {
          "TagKey" : "owner",
          "TagValue" : "zhangsan"
        } ]
      } ]
    },
    "TotalCount" : 1,
    "PageSize" : 1,
    "PageNumber" : 1
  }
}

Error codes

HTTP status code

Error code

Error message

Description

400

RegionId.ApiNotSupported

The api is not supported in this region.

This operation cannot be performed in the specified region. Check whether the region ID is valid.

400

Duplicate.TagKey

The Tag.N.Key contain duplicate key.

The tag key already exists. Tag keys must be unique.

400

InvalidTagKey.Malformed

The specified Tag.n.Key is not valid.

Invalid Tag.N.Key value.

400

InvalidTagValue.Malformed

The specified Tag.n.Value is not valid.

Invalid Tag.N.Value value.

400

MissingParameter.TagKey

You must specify Tag.N.Key.

Tag.N.Key is required.

400

InvalidParam.PageNumber

The specified parameter is invalid.

Invalid PageNumber value.

400

InvalidParam.PageSize

The specified parameter is invalid.

Invalid PageSize value.

403

Operation.Forbidden

The operation is not permitted.

The operation is not supported.

500

InternalError.Dispatch

An error occurred when you dispatched the request.

An error occurred while the request was being sent. Try again later.

500

ServiceUnavailable

The request has failed due to a temporary failure of the server.

The request failed due to a temporary failure of the backend server.

500

InternalError

The request processing has failed due to some unknown error.

An internal error occurred. Try again later.

For a list of error codes, see Service error codes.