|
@@ -56,7 +56,7 @@ must also export them (e.g. ``export DISPLAY=":0"``)
|
|
|
|
|
|
$ celery multi start worker1 \
|
|
$ celery multi start worker1 \
|
|
--pidfile="$HOME/run/celery/%n.pid" \
|
|
--pidfile="$HOME/run/celery/%n.pid" \
|
|
- --logfile="$HOME/log/celery/%n.log"
|
|
|
|
|
|
+ --logfile="$HOME/log/celery/%n%I.log"
|
|
|
|
|
|
$ celery multi restart worker1 --pidfile="$HOME/run/celery/%n.pid"
|
|
$ celery multi restart worker1 --pidfile="$HOME/run/celery/%n.pid"
|
|
|
|
|
|
@@ -97,7 +97,7 @@ This is an example configuration for a Python project.
|
|
CELERYD_OPTS="--time-limit=300 --concurrency=8"
|
|
CELERYD_OPTS="--time-limit=300 --concurrency=8"
|
|
|
|
|
|
# %n will be replaced with the first part of the nodename.
|
|
# %n will be replaced with the first part of the nodename.
|
|
- CELERYD_LOG_FILE="/var/log/celery/%n.log"
|
|
|
|
|
|
+ CELERYD_LOG_FILE="/var/log/celery/%n%I.log"
|
|
CELERYD_PID_FILE="/var/run/celery/%n.pid"
|
|
CELERYD_PID_FILE="/var/run/celery/%n.pid"
|
|
|
|
|
|
# Workers should run as an unprivileged user.
|
|
# Workers should run as an unprivileged user.
|
|
@@ -156,7 +156,9 @@ Available options
|
|
Full path to the PID file. Default is /var/run/celery/%n.pid
|
|
Full path to the PID file. Default is /var/run/celery/%n.pid
|
|
|
|
|
|
* CELERYD_LOG_FILE
|
|
* CELERYD_LOG_FILE
|
|
- Full path to the worker log file. Default is /var/log/celery/%n.log
|
|
|
|
|
|
+ Full path to the worker log file. Default is /var/log/celery/%n%I.log
|
|
|
|
+ **Note**: Using `%I` is important when using the prefork pool as having
|
|
|
|
+ multiple processes share the same log file will lead to race conditions.
|
|
|
|
|
|
* CELERYD_LOG_LEVEL
|
|
* CELERYD_LOG_LEVEL
|
|
Worker log level. Default is INFO.
|
|
Worker log level. Default is INFO.
|
|
@@ -311,8 +313,10 @@ This is an example configuration for a Python project:
|
|
# Extra command-line arguments to the worker
|
|
# Extra command-line arguments to the worker
|
|
CELERYD_OPTS="--time-limit=300 --concurrency=8"
|
|
CELERYD_OPTS="--time-limit=300 --concurrency=8"
|
|
|
|
|
|
- # %n will be replaced with the first part of the nodename.
|
|
|
|
- CELERYD_LOG_FILE="/var/log/celery/%n.log"
|
|
|
|
|
|
+ # - %n will be replaced with the first part of the nodename.
|
|
|
|
+ # - %I will be replaced with the current child process index
|
|
|
|
+ # and is important when using the prefork pool to avoid race conditions.
|
|
|
|
+ CELERYD_LOG_FILE="/var/log/celery/%n%I.log"
|
|
CELERYD_PID_FILE="/var/run/celery/%n.pid"
|
|
CELERYD_PID_FILE="/var/run/celery/%n.pid"
|
|
|
|
|
|
.. _generic-systemd-celeryd-django-example:
|
|
.. _generic-systemd-celeryd-django-example:
|
|
@@ -339,8 +343,9 @@ This is an example configuration for those using `django-celery`:
|
|
# Extra command-line arguments to the worker
|
|
# Extra command-line arguments to the worker
|
|
CELERYD_OPTS="--time-limit=300 --concurrency=8"
|
|
CELERYD_OPTS="--time-limit=300 --concurrency=8"
|
|
|
|
|
|
- # %n will be replaced with the first part of the nodename.
|
|
|
|
- CELERYD_LOG_FILE="/var/log/celery/%n.log"
|
|
|
|
|
|
+ # - %n will be replaced with the first part of the nodename.
|
|
|
|
+ # - %I will be replaced with the current child process index
|
|
|
|
+ CELERYD_LOG_FILE="/var/log/celery/%n%I.log"
|
|
CELERYD_PID_FILE="/var/run/celery/%n.pid"
|
|
CELERYD_PID_FILE="/var/run/celery/%n.pid"
|
|
|
|
|
|
To add an environment variable such as DJANGO_SETTINGS_MODULE use the
|
|
To add an environment variable such as DJANGO_SETTINGS_MODULE use the
|