环境: Django3.1,celery5.2 Django setting.py
CELERY_RESULT_BACKEND = 'django-db'
CELERY_BROKER_URL = 'redis://127.0.0.1/0'
CELERYD_CONCURRENCY = 2 # 并发worker数
# CELERYD_PREFETCH_MULTIPLIER=1
CELERYD_FORCE_EXECV = True
CELERYD_MAX_TASKS_PER_CHILD = 50 celery.py
import os
from celery import Celery
# Set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'san.settings')
app = Celery('san')
app.config_from_object('django.conf:settings', namespace='CELERY')
# Load task modules from all registered Django apps.
app.autodiscover_tasks()celery -A san worker -l INFO -P gevent:启动命令
-芹菜@dev.10.1.1.209 v5.2.3
- .>结果:
并发性: 4,为什么我的配置不生效?在启动命令中指定'-c‘参数是有效的。
我能做些什么来使我的配置工作?
我的其他配置可以工作,如CELERY_BROKER_URL、CELERY_RESULT_BACKEND
发布于 2022-03-17 06:32:48
# Using a string here means the worker doesn't have to serialize
# the configuration object to child processes.
# - namespace='CELERY' means all celery-related configuration keys
# should have a `CELERY_` prefix.将CELERYD CONCURRENCY更改为CELERY_WORKER_CONCURRENCY
https://stackoverflow.com/questions/71169326
复制相似问题