A little task queue for python
docker pull library/redis
docker run -d --name huey --restart always redis:7-alpine
podman run -d --name huey --restart always redis:7-alpine
skopeo inspect docker://docker.io/library/redis:7-alpine
oras pull redis:7-alpine
docker compose up -d
services:
redis:
image: redis:7-alpine
volumes:
- redis-data:/data
web:
build: .
command: ["gunicorn", "my_app.wsgi"]
environment:
REDIS_HOST: redis
depends_on:
- redis
# The worker is built from the same image as the web app, so both see the
# same code and the same task registry.
worker:
build: .
# NOTE: if you scale this service, add "-n" here and run a single
# separate service (without "-n") to enqueue periodic tasks.
command: ["huey_consumer", "my_app.huey", "-w", "4", "-g", "TERM", "-t", "55"]
environment:
REDIS_HOST: redis
depends_on:
- redis
# SIGKILL deadline for a graceful shutdown (default 10s). The consumer's
# -t 55 interrupts still-running tasks just before this.
stop_grace_period: 60s
volumes:
redis-data: