diff --git a/conf/celery-weblate b/conf/celery-weblate index 7b2d738..1005d7c 100644 --- a/conf/celery-weblate +++ b/conf/celery-weblate @@ -1,18 +1,18 @@ # Name of nodes to start -# here we have a single node -CELERYD_NODES="w1" -# or we could have three nodes: -#CELERYD_NODES="w1 w2 w3" +CELERYD_NODES="celery notify search memory" + +# Absolute or relative path to the 'celery' command: +CELERY_BIN="__FINALPATH__/venv/bin/celery" # App instance to use # comment out this line if you don't use an app CELERY_APP="weblate" -# How to call manage.py -CELERYD_MULTI="multi" - # Extra command-line arguments to the worker -CELERYD_OPTS="--beat" +CELERYD_OPTS="--beat:celery --concurrency:celery=4 --queues:celery=celery --prefetch-multiplier:celery=4 \ +--concurrency:notify=4 --queues:notify=notify --prefetch-multiplier:notify=4 \ +--concurrency:search=1 --queues:search=search --prefetch-multiplier:search=2000 \ +--concurrency:memory=1 --queues:memory=memory --prefetch-multiplier:memory=2000" # - %n will be replaced with the first part of the nodename. # - %I will be replaced with the current child process index @@ -21,4 +21,5 @@ CELERYD_PID_FILE="/var/run/__APP__/weblate-celery-%n.pid" CELERYD_LOG_FILE="/var/log/__APP__/weblate-celery-%n%I.log" CELERYD_LOG_LEVEL="INFO" +# Internal Weblate variable to indicate we're running inside Celery CELERY_WORKER_RUNNING="1" diff --git a/conf/celery-weblate.service b/conf/celery-weblate.service index a6fe170..337cf35 100644 --- a/conf/celery-weblate.service +++ b/conf/celery-weblate.service @@ -14,14 +14,14 @@ RuntimeDirectory=__APP__ ExecStartPre=/bin/chown -R __APP__ /var/log/__APP__ -ExecStart=__FINALPATH__/venv/bin/celery multi start ${CELERYD_NODES} \ +ExecStart=/bin/sh -c '${CELERY_BIN} multi start ${CELERYD_NODES} \ -A ${CELERY_APP} --pidfile=${CELERYD_PID_FILE} \ - --logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS} -ExecStop=__FINALPATH__/venv/bin/celery multi stopwait ${CELERYD_NODES} \ - --pidfile=${CELERYD_PID_FILE} -ExecReload=__FINALPATH__/venv/bin/celery multi restart ${CELERYD_NODES} \ + --logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}' +ExecStop=/bin/sh -c '${CELERY_BIN} multi stopwait ${CELERYD_NODES} \ + --pidfile=${CELERYD_PID_FILE}' +ExecReload=/bin/sh -c '${CELERY_BIN} multi restart ${CELERYD_NODES} \ -A ${CELERY_APP} --pidfile=${CELERYD_PID_FILE} \ - --logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS} + --logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}' [Install] WantedBy=multi-user.target