Describes a specified task or tasks.
Currently, stopped tasks appear in the returned results for at least one hour.
If you have tasks with tags, and then delete the cluster, the tagged tasks are returned in the response. If you create a new cluster with the same name as the deleted cluster, the tagged tasks are not included in the response.
Parameters:
-
cluster
(Optional[String], default:
None
)
–
The short name or full Amazon Resource Name (ARN) of the cluster that hosts the task or tasks to describe. If you do not specify a cluster, the default cluster is assumed.
-
tasks
(StringList)
–
A list of up to 100 task IDs or full ARN entries.
-
include
(Optional[TaskFieldList], default:
None
)
–
Specifies whether you want to see the resource tags for the task. If TAGS is specified, the tags are included in the response. If this field is omitted, tags aren't included in the response.
Raises:
-
AccessDeniedException
–
You don't have authorization to perform the requested action.
-
ClientException
–
These errors are usually caused by a client action. This client action might be using an action or resource on behalf of a user that doesn't have permissions to use the action or resource. Or, it might be specifying an identifier that isn't valid.
-
ClusterNotFoundException
–
The specified cluster wasn't found. You can view your available clusters with ListClusters. Amazon ECS clusters are Region specific.
-
InvalidParameterException
–
The specified parameter isn't valid. Review the available parameters for the API request.
For more information about service event errors, see Amazon ECS service event messages.
-
ServerException
–
These errors are usually caused by a server issue.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Examples:
To describe a task
This example provides a description of the specified task, using the task UUID as an identifier.
>>> client.describe_tasks(tasks=['c5cba4eb-5dad-405e-96db-71ef8eefe6a8'])
Source code in docs_src/capo_ecs/_services/ecs.py
| def describe_tasks(
self,
tasks: "capo_ecs.types.string_list.StringList",
*,
config_overrides: Optional[ECSClientConfig] = None,
cluster: Optional["capo_ecs.types.string.String"] = None,
include: Optional["capo_ecs.types.task_field_list.TaskFieldList"] = None,
) -> "capo_ecs.types.describe_tasks_response.DescribeTasksResponse":
"""<p>Describes a specified task or tasks.</p> <p>Currently, stopped tasks appear in the returned results for at least one hour.</p> <p>If you have tasks with tags, and then delete the cluster, the tagged tasks are returned in the response. If you create a new cluster with the same name as the deleted cluster, the tagged tasks are not included in the response.</p>
Args:
cluster: <p>The short name or full Amazon Resource Name (ARN) of the cluster that hosts the task or tasks to describe. If you do not specify a cluster, the default cluster is assumed.</p>
tasks: <p>A list of up to 100 task IDs or full ARN entries.</p>
include: <p>Specifies whether you want to see the resource tags for the task. If <code>TAGS</code> is specified, the tags are included in the response. If this field is omitted, tags aren't included in the response.</p>
Raises:
capo_ecs.errors.access_denied_exception.AccessDeniedException: <p>You don't have authorization to perform the requested action.</p>
capo_ecs.errors.client_exception.ClientException: <p>These errors are usually caused by a client action. This client action might be using an action or resource on behalf of a user that doesn't have permissions to use the action or resource. Or, it might be specifying an identifier that isn't valid.</p>
capo_ecs.errors.cluster_not_found_exception.ClusterNotFoundException: <p>The specified cluster wasn't found. You can view your available clusters with <a href="https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_ListClusters.html">ListClusters</a>. Amazon ECS clusters are Region specific.</p>
capo_ecs.errors.invalid_parameter_exception.InvalidParameterException: <p>The specified parameter isn't valid. Review the available parameters for the API request.</p> <p>For more information about service event errors, see <a href="https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-event-messages-list.html">Amazon ECS service event messages</a>. </p>
capo_ecs.errors.server_exception.ServerException: <p>These errors are usually caused by a server issue.</p>
capo_ecs.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
To describe a task
This example provides a description of the specified task, using the task UUID as an identifier.
>>> client.describe_tasks(tasks=['c5cba4eb-5dad-405e-96db-71ef8eefe6a8'])
"""
def _handler(
req: "OperationRequest[capo_ecs.types.describe_tasks_request.DescribeTasksRequest]",
) -> OperationResponse[
"capo_ecs.types.describe_tasks_response.DescribeTasksResponse"
]:
import capo_ecs._operations.amazon_ec2_container_service_v20141113.describe_tasks
output, http_response = (
capo_ecs._operations.amazon_ec2_container_service_v20141113.describe_tasks.describe_tasks(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
def _redact_output(
output: "capo_ecs.types.describe_tasks_response.DescribeTasksResponse",
) -> dict[str, Any]:
import capo_ecs.types.describe_tasks_response
return capo_ecs.types.describe_tasks_response.redact_sensitive(output)
interceptors_, options_ = self.operation_options(
config_overrides,
OperationLogging("DescribeTasks", redact_output=_redact_output),
)
input_: capo_ecs.types.describe_tasks_request.DescribeTasksRequest = {
"tasks": tasks
}
if cluster is not None:
input_["cluster"] = cluster
if include is not None:
input_["include"] = include
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|