fix: worker health check

This commit is contained in:
Felix Spöttel
2023-02-28 21:22:40 +01:00
parent 120eb537a6
commit 099a0eb1d7
3 changed files with 13 additions and 11 deletions

View File

@@ -16,12 +16,6 @@ from app.web.security import authenticate_api_key
app = FastAPI()
celery = get_celery_binding()
api_router = APIRouter(
prefix="/api/v1",
dependencies=[Depends(authenticate_api_key)],
responses={**DEFAULT_RESPONSES},
)
def queue_task(job: models.Job) -> None:
# queue an async transcription task.
@@ -32,6 +26,13 @@ def queue_task(job: models.Job) -> None:
transcribe.delay(job.id)
api_router = APIRouter(
prefix="/api/v1",
dependencies=[Depends(authenticate_api_key)],
responses={**DEFAULT_RESPONSES},
)
@api_router.get("/", response_model=None, status_code=204)
def api_root() -> None:
return None

View File

@@ -22,7 +22,7 @@ services:
container_name: whisperbox_worker
build:
context: ../../
# ENABLE GPU SUPPORT
# <ENABLE GPU SUPPORT>
# dockerfile: docker/prod/worker.gpu.Dockerfile
dockerfile: docker/prod/worker.Dockerfile
environment: *app-variables
@@ -33,7 +33,7 @@ services:
- app
depends_on:
- redis
# ENABLE GPU SUPPORT
# <ENABLE GPU SUPPORT>
# deploy:
# resources:
# reservations:
@@ -55,7 +55,8 @@ services:
networks:
- app
depends_on:
- worker
worker:
condition: service_healthy
volumes:
- whisperbox-data:/etc/whisperbox/data
- whisper-models:/models

View File

@@ -24,7 +24,7 @@ COPY app ./app
ENV VIRTUAL_ENV /opt/venv
ENV PATH /opt/venv/bin:$PATH
# COPY scripts/download_model.py .
# RUN chmod +x download_model.py && python download_model.py ${WHISPER_MODEL:-small}
COPY scripts/download_model.py .
RUN chmod +x download_model.py && python download_model.py ${WHISPER_MODEL:-small}
CMD celery --app=app.worker.main.celery worker --loglevel=info --concurrency=1