Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle SIGTERM #139

Open
gb-beng opened this issue Oct 18, 2024 · 2 comments
Open

Handle SIGTERM #139

gb-beng opened this issue Oct 18, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@gb-beng
Copy link
Contributor

gb-beng commented Oct 18, 2024

It would be great if the worker/container would gracefully terminate on SIGTERM. Kubernetes can send it e.g. when draining nodes.


To test this I used:

docker run \
  --rm \
  --detach \
  --env W_MODEL=tiny \
  --env W_DEVICE=cpu \
  --env MODEL_BASE_DIR=/model \
  --env DATA_BASE_DIR=/data \
  --name whisper-asr-worker ghcr.io/beeldengeluid/whisper-asr-worker:git-85fa5e3 --service=y
# d0378c37991498afe11038fa8528686cddb754d5ee7caa38fec042b93b75888a
docker ps
# CONTAINER ID   IMAGE                                                  COMMAND                  CREATED          STATUS          PORTS     NAMES
# d0378c379914   ghcr.io/beeldengeluid/whisper-asr-worker:git-85fa5e3   "./docker-entrypoint…"   4 seconds ago    Up 3 seconds              whisper-asr-worker
docker container kill --signal=SIGTERM whisper-asr-worker
# whisper-asr-worker
sleep 120 && docker ps
# CONTAINER ID   IMAGE                                                  COMMAND                  CREATED          STATUS              PORTS     NAMES
# d0378c379914   ghcr.io/beeldengeluid/whisper-asr-worker:git-85fa5e3   "./docker-entrypoint…"   2 minutes ago    Up About a minute             whisper-asr-worker

Note that SIGINT does work.

@gb-beng gb-beng added the enhancement New feature or request label Oct 18, 2024
@greenw0lf
Copy link
Collaborator

@gb-beng would it be possible to use docker stop whisper-asr-worker instead of the kill command? From what I could find, it seems like the standard approach as it first sends SIGTERM, then after 10s it sends SIGKILL. But if kubernetes handles these operations through docker kill, then I'll keep investigating how to handle it because it is taking longer than expected to find a solution

Also, using docker container kill but with the SIGINT signal doesn't work for me (I'm not sure how you tested that)

@greenw0lf greenw0lf self-assigned this Oct 24, 2024
@gb-beng
Copy link
Contributor Author

gb-beng commented Oct 24, 2024

@gb-beng would it be possible to use docker stop whisper-asr-worker instead of the kill command? From what I could find, it seems like the standard approach as it first sends SIGTERM, then after 10s it sends SIGKILL.

Kubernetes doesn't use docker commands to send these signals, I just used it for testing/illustration. There is an equivalent to docker stop, but the point is that I'd like to gracefully stop the process instead of killing it.

I'll keep investigating how to handle it because it is taking longer than expected to find a solution

I wouldn't spend too much time on it now, let's focus on the distributed/scalable deployment first, as it will affect this issue as well.

Also, using docker container kill but with the SIGINT signal doesn't work for me (I'm not sure how you tested that)

You're right SIGINT also doesn't work...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants