A
A
adrenalinruslan2021-08-07 14:15:50
Django
adrenalinruslan, 2021-08-07 14:15:50

How to save uncompleted celery tasks?

Hello, I have a Django project and I added pending tasks. All pending / completed tasks are displayed through flower (127.0.0.1:5555), everything is ok, but if you stop the docker and start it back, all tasks disappear, is it possible to save them somehow? It may just be that there are pending tasks, but the docker crashed and started back up and it turns out there are no more tasks.

version: '3'

services:
  redis:
    image: redis
    restart: always
    volumes:
      - redis:/data
    ports:
      - "6379:6379"

  db:
    image: mysql:5.7
    restart: always
    ports:
      - "3306:3306"
    volumes:
      - database:/var/lib/mysql
    env_file:
      - ./backend/.env
    command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci

  web:
    build: ./backend/
    restart: always
    command: gunicorn config.wsgi:application --bind 0.0.0.0:8000
    volumes:
      - static:/Project/static/
      - media:/Project/media/
    depends_on:
      - db
      - redis

  celery:
    build: ./backend/
    restart: always
    command: celery -A config worker -l info
    depends_on:
      - web

  flower:
    build: ./backend/
    restart: always
    command: celery -A config flower --loglevel=info --url_prefix=cron
    ports:
      - "5555:5555"
    depends_on:
      - celery

  nginx:
    image: nginx:1.19.3
    restart: always
    ports:
      - "80:80"
    volumes:
      - ./nginx/default.dev.conf:/etc/nginx/conf.d/default.conf
      - static:/var/html/static/
      - media:/var/html/media/
    depends_on:
      - flower

volumes:
  redis:
  database:
  static:
  media:

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Karabanov, 2021-08-08
@karabanov

There is no volume for permanent storage of celery data.
Add it like you did with redis or MySQL.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question