stop_task¶
Operation¶
stop_task
async
¶
stop_task(request: StopTaskInput | StopTaskInputDict, /, *, plugins: list[Plugin] | None = None) -> StopTaskOutput
stop_task(*, plugins: list[Plugin] | None = None, **kwargs: Unpack[StopTaskInputDict]) -> StopTaskOutput
Stops a running task. Any tags associated with the task will be deleted.
When you call StopTask on a task, the equivalent of docker stop is
issued to the containers running in the task. This results in a stop
signal value and a default 30-second timeout, after which the SIGKILL
value is sent and the containers are forcibly stopped. This signal can
be defined in your container image with the STOPSIGNAL instruction and
will default to SIGTERM. If the container handles the SIGTERM value
gracefully and exits within 30 seconds from receiving it, no SIGKILL
value is sent.
For Windows containers, POSIX signals do not work and runtime stops the
container by sending a CTRL_SHUTDOWN_EVENT. For more information, see
[Unable to react to graceful shutdown of (Windows) container
25982](https://github.com/moby/moby/issues/25982) on GitHub.¶
Note
The default 30-second timeout can be configured on the Amazon ECS
container agent with the ECS_CONTAINER_STOP_TIMEOUT variable. For more
information, see Amazon ECS Container Agent
Configuration
in the Amazon Elastic Container Service Developer Guide.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
plugins
|
list[Plugin] | None
|
A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations. |
None
|
Returns:
| Type | Description |
|---|---|
StopTaskOutput
|
An instance of |
Input¶
Pass the input fields as keyword arguments, or pass a model or dictionary as the first positional argument. Pass plugins separately as a keyword argument.
Model¶
StopTaskInput
dataclass
¶
Bases: _SerdeShape
Attributes¶
cluster
class-attribute
instance-attribute
¶
cluster: str | None = ...
The short name or full Amazon Resource Name (ARN) of the cluster that hosts the task to stop. If you do not specify a cluster, the default cluster is assumed.
reason
class-attribute
instance-attribute
¶
reason: str | None = ...
An optional message specified when a task is stopped. For example, if you're using a custom scheduler, you can use this parameter to specify the reason for stopping the task here, and the message appears in subsequent DescribeTasks> API operations on this task.
Dictionaries¶
StopTaskInputDict
¶
Bases: TypedDict
Dictionary form of StopTaskInput.
Attributes¶
cluster
instance-attribute
¶
cluster: str | None
The short name or full Amazon Resource Name (ARN) of the cluster that hosts the task to stop. If you do not specify a cluster, the default cluster is assumed.
reason
instance-attribute
¶
reason: str | None
An optional message specified when a task is stopped. For example, if you're using a custom scheduler, you can use this parameter to specify the reason for stopping the task here, and the message appears in subsequent DescribeTasks> API operations on this task.