[Python] Count redis queue length in docker

Discussão em 'Python' iniciado por Stack, Dezembro 17, 2024.

  1. Stack

    Stack Membro Participativo

    I have a Celery+Redis python application.

    I have to find number of tasks in queue. I trying this command, but the output is zero. I am confident that queue is not empty.

    redis-cli -n 1 -h localhost -p 6379 llen celery

    (integer) 0


    I think I am using invalid arguments. My redis + celery configuration:

    celery:
    build: ./project
    command: celery -A core_app worker --loglevel=info --concurrency=15 --max-memory-per-child=1000000
    volumes:
    - ./project:/usr/src/app
    - ./project/media:/project/media
    - ./project/logs:/project/logs
    env_file:
    - .env
    environment:
    # environment variables declared in the environment section override env_file
    - DJANGO_ALLOWED_HOSTS=localhost 127.0.0.1 [::1]
    - CELERY_BROKER=redis://redis:6379/0
    - CELERY_BACKEND=redis://redis:6379/0
    depends_on:
    - django
    - redis

    redis:
    build:
    context: ./redis_customization
    dockerfile: Dockerfile
    image: redis:7.2-alpine
    restart: always
    ports:
    - 6379:6379
    # Run the init script
    command: sh -c "./init.sh"
    # Run as privileged to allow the container to change the vm.overcommit_memory setting
    privileged: true

    Continue reading...

Compartilhe esta Página