Amazon-ecs-agent: How to trigger ECS agent actions through API?

Created on 30 Dec 2016  Â·  7Comments  Â·  Source: aws/amazon-ecs-agent

Hi,

When I look at
http://boto3.readthedocs.io/en/latest/reference/services/ecs.html#ECS.Client.stop_task

It says it will issue a docker stop with a 30 seconds timeout. I have configured the ECS_CONTAINER_STOP_TIMEOUT of the ecs agent to 10m, but apparently this won't be taken into account. Is there a way for me to trigger the ECS agent "stop task" using an API so I the environment variables get taken into account?

Thanks!

kinquestion

All 7 comments

@simplesteph The StopTask API uses the timeout specified in ECS_CONTAINER_STOP_TIMEOUT. We'll get the documentation updated to reflect that (looks like we missed updating the documentation when we added the environment variable).

Are you running into problems using the environment variable or just looking to confirm the behavior?

Hi I was looking into the behaviour and it wasn't specified. Thanks for
updating the documentation that helps clarifying it !

I think the only issue I'd be running into is that if I issue a docker stop
within the instance it won't take the variable into account ? I think
that's docker related ?

On 31 Dec. 2016 2:47 pm, "Samuel Karp" notifications@github.com wrote:

@simplesteph https://github.com/simplesteph The StopTask API uses the
timeout specified in ECS_CONTAINER_STOP_TIMEOUT. We'll get the
documentation updated to reflect that (looks like we missed updating the
documentation when we added the environment variable).

Are you running into problems using the environment variable or just
looking to confirm the behavior?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/aws/amazon-ecs-agent/issues/653#issuecomment-269847386,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AT4raZbh2t663koJmY19Zx2bbi0uCs7qks5rNdBYgaJpZM4LX6Rt
.

Correct, manually issuing docker stop is independent of any settings you have on the ECS agent. To specify a timeout for docker stop, you can use the --time argument with a number of seconds (see docker help stop for details).

That's what I figured ... Would have been great if defaults were set as the
purpose of the ecs agent and docker are quite close. I don't think the ecs
agent could also set any defaults for docker could it ?

On 31 Dec. 2016 3:14 pm, "Samuel Karp" notifications@github.com wrote:

Correct, manually issuing docker stop is independent of any settings you
have on the ECS agent. To specify a timeout for docker stop, you can use
the --time argument with a number of seconds (see docker help stop for
details).

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/aws/amazon-ecs-agent/issues/653#issuecomment-269848271,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AT4raZqrKxEPC2ti_tw6WRqF9MmQHp3Cks5rNdawgaJpZM4LX6Rt
.

We don't modify the behavior of the Docker daemon or Docker CLI; we'd prefer that it match the behavior you'd experience in your development environment.

Thanks for opening this and letting us know our docs were out of date! Since it sounds like you just wanted that clarified and are not currently experiencing any issues, I'm going to close this. Please feel free to open new issues if you experience any problems.

@samuelkarp
Sorry to follow up, maybe it's not a bug or I'm not doing things right, but it seems that when I terminate the instance using the API, the shutdown command doesn't seem to respect the timeout as dictated by the ecs-agent. Therefore my tasks don't have the time to finish properly. Do you have a workaround for this or is it a bug?

Actually it should be addressed by https://github.com/docker/docker/pull/23036 and https://github.com/docker/docker/pull/22566. Hopefully AWS will be quick to update to docker 1.13 when it's released... I see we're still at 1.11

Was this page helpful?
0 / 5 - 0 ratings