Initial commit to support Celery 4.3.0
Merges 55e9b2263c from versions/next
with code from GitLab issue #594 and GitLab merge request !55.
Thanks to Jakob Haufe (@sur5r) and Jesaja Everling (@jeverling)
for much of the research and code updates.
Signed-off-by: Roberto Rosario <roberto.rosario@mayan-edms.com>
This commit is contained in:
2
Makefile
2
Makefile
@@ -258,7 +258,7 @@ test-with-docker-frontend: ## Launch a front end instance that uses the producti
|
||||
./manage.py runserver --settings=mayan.settings.staging.docker
|
||||
|
||||
test-with-docker-worker: ## Launch a worker instance that uses the production-like services.
|
||||
./manage.py celery worker --settings=mayan.settings.staging.docker -B -l INFO -O fair
|
||||
DJANGO_SETTINGS_MODULE=mayan.settings.staging.docker ./manage.py celery worker -A mayan -B -l INFO -O fair
|
||||
|
||||
docker-mysql-on: ## Launch and initialize a MySQL Docker container.
|
||||
docker run -d --name mysql -p 3306:3306 -e MYSQL_ALLOW_EMPTY_PASSWORD=True -e MYSQL_DATABASE=mayan_edms mysql
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# BASE_IMAGE - Bare bones image with the base packages needed to run Mayan EDMS
|
||||
####
|
||||
|
||||
FROM debian:9.8-slim as BASE_IMAGE
|
||||
FROM debian:10.0-slim as BASE_IMAGE
|
||||
|
||||
LABEL maintainer="Roberto Rosario roberto.rosario@mayan-edms.com"
|
||||
|
||||
@@ -29,7 +29,7 @@ apt-get update \
|
||||
graphviz \
|
||||
libfuse2 \
|
||||
libmagic1 \
|
||||
libmariadbclient18 \
|
||||
libmmariadb3 \
|
||||
libreoffice \
|
||||
libpq5 \
|
||||
poppler-utils \
|
||||
@@ -96,31 +96,31 @@ apt-get install -y --no-install-recommends \
|
||||
libssl-dev \
|
||||
g++ \
|
||||
gcc \
|
||||
python-dev \
|
||||
python-virtualenv \
|
||||
python3-dev \
|
||||
python3-venv \
|
||||
&& mkdir -p "${PROJECT_INSTALL_DIR}" \
|
||||
&& chown -R mayan:mayan "${PROJECT_INSTALL_DIR}" \
|
||||
&& chown -R mayan:mayan /src
|
||||
|
||||
USER mayan
|
||||
RUN python -m virtualenv "${PROJECT_INSTALL_DIR}" \
|
||||
RUN python3 -m venv "${PROJECT_INSTALL_DIR}" \
|
||||
&& . "${PROJECT_INSTALL_DIR}/bin/activate" \
|
||||
&& pip install --no-cache-dir --no-use-pep517 \
|
||||
librabbitmq==1.6.1 \
|
||||
mysql-python==1.2.5 \
|
||||
psycopg2==2.7.3.2 \
|
||||
redis==2.10.6 \
|
||||
&& pip install --no-cache-dir \
|
||||
librabbitmq==2.0.0 \
|
||||
mysqlclient==1.4.2.post1 \
|
||||
psycopg2==2.8.3 \
|
||||
redis==3.2.1 \
|
||||
# psutil is needed by ARM builds otherwise gevent and gunicorn fail to start
|
||||
&& UNAME=`uname -m` && if [ "${UNAME#*arm}" != $UNAME ]; then \
|
||||
pip install --no-cache-dir --no-use-pep517 \
|
||||
pip install --no-cache-dir \
|
||||
psutil==5.6.2 \
|
||||
; fi \
|
||||
# Install the Python packages needed to build Mayan EDMS
|
||||
&& pip install --no-cache-dir --no-use-pep517 -r /src/requirements/build.txt \
|
||||
&& pip install --no-cache-dir -r /src/requirements/build.txt \
|
||||
# Build Mayan EDMS
|
||||
&& python setup.py sdist \
|
||||
# Install the built Mayan EDMS package
|
||||
&& pip install --no-cache-dir --no-use-pep517 dist/mayan* \
|
||||
&& pip install --no-cache-dir dist/mayan* \
|
||||
# Install the static content
|
||||
&& mayan-edms.py installdependencies \
|
||||
&& MAYAN_STATIC_ROOT=${PROJECT_INSTALL_DIR}/static mayan-edms.py preparestatic --link --noinput
|
||||
|
||||
@@ -8,12 +8,12 @@ CONCURRENCY_ARGUMENT=--concurrency=
|
||||
DEFAULT_USER_UID=1000
|
||||
DEFAULT_USER_GUID=1000
|
||||
|
||||
export MAYAN_DEFAULT_BROKER_URL=redis://127.0.0.1:6379/0
|
||||
export MAYAN_DEFAULT_CELERY_BROKER_URL=redis://127.0.0.1:6379/0
|
||||
export MAYAN_DEFAULT_CELERY_RESULT_BACKEND=redis://127.0.0.1:6379/0
|
||||
|
||||
export MAYAN_ALLOWED_HOSTS='["*"]'
|
||||
export MAYAN_BIN=/opt/mayan-edms/bin/mayan-edms.py
|
||||
export MAYAN_BROKER_URL=${MAYAN_BROKER_URL:-${MAYAN_DEFAULT_BROKER_URL}}
|
||||
export MAYAN_CELERY_BROKER_URL=${MAYAN_CELERY_BROKER_URL:-${MAYAN_DEFAULT_CELERY_BROKER_URL}}
|
||||
export MAYAN_CELERY_RESULT_BACKEND=${MAYAN_CELERY_RESULT_BACKEND:-${MAYAN_DEFAULT_CELERY_RESULT_BACKEND}}
|
||||
export MAYAN_INSTALL_DIR=/opt/mayan-edms
|
||||
export MAYAN_PYTHON_BIN_DIR=/opt/mayan-edms/bin/
|
||||
|
||||
@@ -220,11 +220,11 @@ of a restart or power failure. The Gunicorn workers are increased to 3.
|
||||
---------------------------------------------------------------------
|
||||
Replace (paying attention to the comma at the end)::
|
||||
|
||||
MAYAN_BROKER_URL="redis://127.0.0.1:6379/0",
|
||||
MAYAN_CELERY_BROKER_URL="redis://127.0.0.1:6379/0",
|
||||
|
||||
with::
|
||||
|
||||
MAYAN_BROKER_URL="amqp://mayan:mayanrabbitmqpassword@localhost:5672/mayan",
|
||||
MAYAN_CELERY_BROKER_URL="amqp://mayan:mayanrabbitmqpassword@localhost:5672/mayan",
|
||||
|
||||
increase the number of Gunicorn workers to 3 in the line (``-w 2`` section)::
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@ the default port. Not used with SQLite. For more information read the
|
||||
pertinent Django documentation page:
|
||||
:django-docs:`Settings, PORT <ref/settings/#port>`
|
||||
|
||||
``MAYAN_BROKER_URL``
|
||||
``MAYAN_CELERY_BROKER_URL``
|
||||
|
||||
This optional environment variable determines the broker that Celery will use
|
||||
to relay task messages between the frontend code and the background workers.
|
||||
@@ -200,7 +200,7 @@ For more information read the pertinent Celery Kombu documentation page: `Broker
|
||||
|
||||
This Docker image supports using Redis and RabbitMQ as brokers.
|
||||
|
||||
Caveat: If the `MAYAN_BROKER_URL` and `MAYAN_CELERY_RESULT_BACKEND` environment
|
||||
Caveat: If the `MAYAN_CELERY_BROKER_URL` and `MAYAN_CELERY_RESULT_BACKEND` environment
|
||||
variables are specified, the built-in Redis server inside the container will
|
||||
be disabled.
|
||||
|
||||
@@ -215,7 +215,7 @@ code. For more information read the pertinent Celery Kombu documentation page:
|
||||
|
||||
This Docker image supports using Redis and RabbitMQ as result backends.
|
||||
|
||||
Caveat: If the `MAYAN_BROKER_URL` and `MAYAN_CELERY_RESULT_BACKEND` environment
|
||||
Caveat: If the `MAYAN_CELERY_BROKER_URL` and `MAYAN_CELERY_RESULT_BACKEND` environment
|
||||
variables are specified, the built-in Redis server inside the container will
|
||||
be disabled.
|
||||
|
||||
|
||||
@@ -94,11 +94,11 @@ For the Docker image, launch a separate RabbitMQ container
|
||||
|
||||
docker run -d --name mayan-edms-rabbitmq -e RABBITMQ_DEFAULT_USER=mayan -e RABBITMQ_DEFAULT_PASS=mayanrabbitmqpassword -e RABBITMQ_DEFAULT_VHOST=mayan rabbitmq:3
|
||||
|
||||
Pass the MAYAN_BROKER_URL environment variable (https://kombu.readthedocs.io/en/latest/userguide/connections.html#connection-urls)
|
||||
Pass the MAYAN_CELERY_BROKER_URL environment variable (https://kombu.readthedocs.io/en/latest/userguide/connections.html#connection-urls)
|
||||
to the Mayan EDMS container so that it uses the RabbitMQ container the
|
||||
message broker::
|
||||
|
||||
-e MAYAN_BROKER_URL="amqp://mayan:mayanrabbitmqpassword@localhost:5672/mayan",
|
||||
-e MAYAN_CELERY_BROKER_URL="amqp://mayan:mayanrabbitmqpassword@localhost:5672/mayan",
|
||||
|
||||
When tasks finish, they leave behind a return status or the result of a
|
||||
calculation, these are stored for a while so that whoever requested the
|
||||
|
||||
@@ -52,7 +52,9 @@ Changes
|
||||
- Backport file cache manager app.
|
||||
- Convert document image cache to use file cache manager app.
|
||||
Add setting DOCUMENTS_CACHE_MAXIMUM_SIZE defaults to 500 MB.
|
||||
|
||||
- Update Celery to version 4.3.0. Settings changed:
|
||||
MAYAN_BROKER_URL to MAYAN_CELERY_BROKER_URL,
|
||||
MAYAN_CELERY_ALWAYS_EAGER to MAYAN_CELERY_TASK_ALWAYS_EAGER.
|
||||
|
||||
Removals
|
||||
--------
|
||||
|
||||
@@ -117,31 +117,39 @@ PythonDependency(
|
||||
Celery under the GPL license. The BSD license, unlike the GPL,
|
||||
let you distribute a modified version without making your
|
||||
changes open source.
|
||||
''', module=__name__, name='celery', version_string='==3.1.24'
|
||||
''', module=__name__, name='celery', version_string='==4.3.0'
|
||||
)
|
||||
PythonDependency(
|
||||
copyright_text='''
|
||||
Copyright (c) 2012-2013 GoPivotal, Inc. All Rights Reserved.
|
||||
Copyright (c) 2015-2016 Ask Solem. All Rights Reserved.
|
||||
Copyright (c) 2012-2014 GoPivotal, Inc. All Rights Reserved.
|
||||
Copyright (c) 2009-2012 Ask Solem. All Rights Reserved.
|
||||
All rights reserved.
|
||||
|
||||
django-celery-beat is licensed under The BSD License (3 Clause, also known as
|
||||
the new BSD license). The license is an OSI approved Open Source
|
||||
license and is GPL-compatible(1).
|
||||
|
||||
The license text can also be found here:
|
||||
http://www.opensource.org/licenses/BSD-3-Clause
|
||||
|
||||
License
|
||||
=======
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of Ask Solem nor the names of its contributors may be used
|
||||
to endorse or promote products derived from this software without specific
|
||||
prior written permission.
|
||||
* Neither the name of Ask Solem nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Ask Solem OR CONTRIBUTORS
|
||||
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
@@ -149,7 +157,25 @@ PythonDependency(
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
''', module=__name__, name='django-celery', version_string='==3.2.1'
|
||||
|
||||
Documentation License
|
||||
=====================
|
||||
|
||||
The documentation portion of django-celery-beat (the rendered contents of the
|
||||
"docs" directory of a software distribution or checkout) is supplied
|
||||
under the "Creative Commons Attribution-ShareAlike 4.0
|
||||
International" (CC BY-SA 4.0) License as described by
|
||||
http://creativecommons.org/licenses/by-sa/4.0/
|
||||
|
||||
Footnotes
|
||||
=========
|
||||
(1) A GPL-compatible license makes it possible to
|
||||
combine django-celery-beat with other software that is released
|
||||
under the GPL, it does not mean that we're distributing
|
||||
django-celery-beat under the GPL license. The BSD license, unlike the GPL,
|
||||
let you distribute a modified version without making your
|
||||
changes open source.
|
||||
''', module=__name__, name='django-celery-beat', version_string='==1.5.0'
|
||||
)
|
||||
PythonDependency(
|
||||
module=__name__, name='django-downloadview', version_string='==1.9'
|
||||
|
||||
@@ -107,7 +107,7 @@ class Statistic(object):
|
||||
day_of_month=day_of_month, month_of_year=month_of_year,
|
||||
)
|
||||
|
||||
app.conf.CELERYBEAT_SCHEDULE.update(
|
||||
app.conf.beat_schedule.update(
|
||||
{
|
||||
self.get_task_name(): {
|
||||
'task': task_execute_statistic.dotted_path,
|
||||
@@ -117,7 +117,7 @@ class Statistic(object):
|
||||
}
|
||||
)
|
||||
|
||||
app.conf.CELERY_ROUTES.update(
|
||||
app.conf.task_routes.update(
|
||||
{
|
||||
self.get_task_name(): {
|
||||
'queue': queue_statistics.name
|
||||
|
||||
@@ -140,9 +140,9 @@ class PlatformTemplateSupervisord(PlatformTemplate):
|
||||
environment_name='MAYAN_ALLOWED_HOSTS'
|
||||
),
|
||||
YAMLVariable(
|
||||
name='BROKER_URL',
|
||||
name='CELERY_BROKER_URL',
|
||||
default='redis://127.0.0.1:6379/0',
|
||||
environment_name='MAYAN_BROKER_URL'
|
||||
environment_name='MAYAN_CELERY_BROKER_URL'
|
||||
),
|
||||
YAMLVariable(
|
||||
name='CELERY_RESULT_BACKEND',
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
[supervisord]
|
||||
environment=
|
||||
PYTHONPATH={{ INSTALLATION_PATH }}/lib/python2.7/site-packages:{{ MEDIA_ROOT }}/mayan_settings,
|
||||
PYTHONPATH={{ INSTALLATION_PATH }}/lib/python3.7/site-packages:{{ MEDIA_ROOT }}/mayan_settings,
|
||||
DJANGO_SETTINGS_MODULE=mayan.settings.production,
|
||||
MAYAN_MEDIA_ROOT="{{ MEDIA_ROOT }}",
|
||||
MAYAN_ALLOWED_HOSTS="{{ ALLOWED_HOSTS }}",
|
||||
MAYAN_CELERY_RESULT_BACKEND="{{ CELERY_RESULT_BACKEND }}",
|
||||
MAYAN_BROKER_URL="{{ BROKER_URL }}",
|
||||
MAYAN_CELERY_BROKER_URL="{{ CELERY_BROKER_URL }}",
|
||||
MAYAN_DATABASES="{{ DATABASES }}"
|
||||
|
||||
[program:mayan-gunicorn]
|
||||
@@ -18,7 +18,7 @@ user = mayan
|
||||
[program:mayan-worker-{{ worker.name }}]
|
||||
autorestart = true
|
||||
autostart = true
|
||||
command = nice -n {{ worker.nice_level }} {{ INSTALLATION_PATH }}/bin/mayan-edms.py celery worker -Ofair -l ERROR -Q {% for queue in worker.queues %}{{ queue.name }}{% if not forloop.last %},{% endif %}{% endfor %} -n mayan-worker-{{ worker.name }}.%%h --concurrency=1
|
||||
command = nice -n {{ worker.nice_level }} {{ INSTALLATION_PATH }}/bin/celery worker -A mayan -Ofair -l ERROR -Q {% for queue in worker.queues %}{{ queue.name }}{% if not forloop.last %},{% endif %}{% endfor %} -n mayan-worker-{{ worker.name }}.%%h --concurrency=1
|
||||
killasgroup = true
|
||||
numprocs = 1
|
||||
priority = 998
|
||||
@@ -30,7 +30,7 @@ user = mayan
|
||||
[program:mayan-celery-beat]
|
||||
autorestart = true
|
||||
autostart = true
|
||||
command = nice -n 1 {{ INSTALLATION_PATH }}/bin/mayan-edms.py celery beat --pidfile= -l ERROR
|
||||
command = nice -n 1 {{ INSTALLATION_PATH }}/bin/celery beat -A mayan --pidfile= -l ERROR
|
||||
killasgroup = true
|
||||
numprocs = 1
|
||||
priority = 998
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
[supervisord]
|
||||
environment=
|
||||
DJANGO_SETTINGS_MODULE="%(ENV_MAYAN_SETTINGS_MODULE)s"
|
||||
|
||||
[program:mayan-gunicorn]
|
||||
autorestart = false
|
||||
autostart = true
|
||||
@@ -12,7 +16,7 @@ user = mayan
|
||||
[program:redis]
|
||||
autorestart = false
|
||||
autostart = true
|
||||
command = /bin/bash -c "if [ ${MAYAN_BROKER_URL} == ${MAYAN_DEFAULT_BROKER_URL} ] && [ ${MAYAN_CELERY_RESULT_BACKEND} == ${MAYAN_DEFAULT_CELERY_RESULT_BACKEND} ];then /usr/bin/redis-server /etc/redis/;fi"
|
||||
command = /bin/bash -c "if [ ${MAYAN_CELERY_BROKER_URL} == ${MAYAN_DEFAULT_CELERY_BROKER_URL} ] && [ ${MAYAN_CELERY_RESULT_BACKEND} == ${MAYAN_DEFAULT_CELERY_RESULT_BACKEND} ];then /usr/bin/redis-server /etc/redis/;fi"
|
||||
stderr_logfile = /dev/fd/2
|
||||
stderr_logfile_maxbytes = 0
|
||||
stdout_logfile = /dev/fd/1
|
||||
@@ -23,7 +27,7 @@ user = root
|
||||
[program:mayan-worker-{{ worker.name }}]
|
||||
autorestart = false
|
||||
autostart = true
|
||||
command = nice -n {{ worker.nice_level }} /bin/bash -c "${MAYAN_BIN} celery --settings=${MAYAN_SETTINGS_MODULE} worker -Ofair -l ERROR -Q {% for queue in worker.queues %}{{ queue.name }}{% if not forloop.last %},{% endif %}{% endfor %} -n mayan-worker-{{ worker.name }}.%%h ${MAYAN_WORKER_{{ worker.name|upper }}_CONCURRENCY}"
|
||||
command = nice -n {{ worker.nice_level }} /bin/bash -c "${MAYAN_PYTHON_BIN_DIR}celery worker -A mayan -Ofair -l ERROR -Q {% for queue in worker.queues %}{{ queue.name }}{% if not forloop.last %},{% endif %}{% endfor %} -n mayan-worker-{{ worker.name }}.%%h ${MAYAN_WORKER_{{ worker.name|upper }}_CONCURRENCY}"
|
||||
killasgroup = true
|
||||
numprocs = 1
|
||||
priority = 998
|
||||
@@ -39,7 +43,7 @@ user = mayan
|
||||
[program:mayan-celery-beat]
|
||||
autorestart = false
|
||||
autostart = true
|
||||
command = nice -n 1 /bin/bash -c "${MAYAN_BIN} celery --settings=${MAYAN_SETTINGS_MODULE} beat --pidfile= -l ERROR"
|
||||
command = nice -n 1 /bin/bash -c "${MAYAN_PYTHON_BIN_DIR}celery -A mayan beat --pidfile= -l ERROR"
|
||||
killasgroup = true
|
||||
numprocs = 1
|
||||
priority = 998
|
||||
|
||||
@@ -34,7 +34,11 @@ def get_environment_variables():
|
||||
|
||||
|
||||
def get_environment_setting(name, fallback_default=None):
|
||||
value = os.environ.get('MAYAN_{}'.format(name), get_default(name=name, fallback_default=fallback_default))
|
||||
value = os.environ.get(
|
||||
'MAYAN_{}'.format(name), get_default(
|
||||
name=name, fallback_default=fallback_default
|
||||
)
|
||||
)
|
||||
|
||||
if value:
|
||||
return yaml.load(stream=value, Loader=SafeLoader)
|
||||
|
||||
@@ -7,7 +7,7 @@ from django.db import models, transaction
|
||||
from django.utils.encoding import force_text, python_2_unicode_compatible
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from djcelery.models import PeriodicTask, IntervalSchedule
|
||||
from django_celery_beat.models import PeriodicTask, IntervalSchedule
|
||||
from model_utils.managers import InheritanceManager
|
||||
|
||||
from mayan.apps.common.compressed_files import Archive
|
||||
|
||||
@@ -156,13 +156,13 @@ class CeleryQueue(object):
|
||||
if self.transient:
|
||||
kwargs['delivery_mode'] = 1
|
||||
|
||||
celery_app.conf.CELERY_QUEUES.append(Queue(**kwargs))
|
||||
celery_app.conf.task_queues.append(Queue(**kwargs))
|
||||
|
||||
if self.default_queue:
|
||||
celery_app.conf.CELERY_DEFAULT_QUEUE = self.name
|
||||
celery_app.conf.task_default_queue = self.name
|
||||
|
||||
for task_type in self.task_types:
|
||||
celery_app.conf.CELERY_ROUTES.update(
|
||||
celery_app.conf.task_routes.update(
|
||||
{
|
||||
task_type.dotted_path: {
|
||||
'queue': self.name
|
||||
@@ -171,7 +171,7 @@ class CeleryQueue(object):
|
||||
)
|
||||
|
||||
if task_type.schedule:
|
||||
celery_app.conf.CELERYBEAT_SCHEDULE.update(
|
||||
celery_app.conf.beat_schedule.update(
|
||||
{
|
||||
task_type.name: {
|
||||
'task': task_type.dotted_path,
|
||||
|
||||
@@ -10,7 +10,7 @@ __all__ = ()
|
||||
namespace = Namespace(label=_('Celery'), name='celery')
|
||||
|
||||
setting_celery_broker_url = namespace.add_setting(
|
||||
global_name='BROKER_URL', default=None,
|
||||
global_name='CELERY_BROKER_URL', default=None,
|
||||
help_text=_(
|
||||
'Default: "amqp://". Default broker URL. This must be a URL in '
|
||||
'the form of: transport://userid:password@hostname:port/virtual_host '
|
||||
|
||||
@@ -9,6 +9,5 @@ from .runtime import celery_class
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mayan.settings.production')
|
||||
|
||||
app = celery_class('mayan')
|
||||
|
||||
app.config_from_object('django.conf:settings')
|
||||
app.config_from_object('django.conf:settings', namespace='CELERY')
|
||||
app.autodiscover_tasks(lambda: settings.INSTALLED_APPS)
|
||||
|
||||
@@ -74,7 +74,7 @@ INSTALLED_APPS = (
|
||||
'actstream',
|
||||
'colorful',
|
||||
'corsheaders',
|
||||
'djcelery',
|
||||
'django_celery_beat',
|
||||
'formtools',
|
||||
'mathfilters',
|
||||
'mptt',
|
||||
@@ -280,18 +280,25 @@ PAGINATION_SETTINGS = {
|
||||
|
||||
# ----------- Celery ----------
|
||||
|
||||
CELERY_BROKER_URL = get_environment_setting(name='CELERY_BROKER_URL')
|
||||
CELERY_RESULT_BACKEND = get_environment_setting(name='CELERY_RESULT_BACKEND')
|
||||
CELERY_TASK_ALWAYS_EAGER = get_environment_setting(
|
||||
name='CELERY_TASK_ALWAYS_EAGER'
|
||||
)
|
||||
|
||||
CELERY_ACCEPT_CONTENT = ('json',)
|
||||
CELERY_ALWAYS_EAGER = False
|
||||
CELERY_CREATE_MISSING_QUEUES = False
|
||||
CELERY_BEAT_SCHEDULE = {}
|
||||
CELERY_BEAT_SCHEDULER = 'django_celery_beat.schedulers.DatabaseScheduler'
|
||||
CELERY_DISABLE_RATE_LIMITS = True
|
||||
CELERY_EAGER_PROPAGATES_EXCEPTIONS = True
|
||||
CELERY_ENABLE_UTC = True
|
||||
CELERY_QUEUES = []
|
||||
CELERY_RESULT_SERIALIZER = 'json'
|
||||
CELERY_ROUTES = {}
|
||||
CELERY_TASK_ALWAYS_EAGER = False
|
||||
CELERY_TASK_CREATE_MISSING_QUEUES = False
|
||||
CELERY_TASK_EAGER_PROPAGATES = True
|
||||
CELERY_TASK_QUEUES = []
|
||||
CELERY_TASK_ROUTES = {}
|
||||
CELERY_TASK_SERIALIZER = 'json'
|
||||
CELERY_TIMEZONE = 'UTC'
|
||||
CELERYBEAT_SCHEDULER = 'djcelery.schedulers.DatabaseScheduler'
|
||||
|
||||
# ------------ CORS ------------
|
||||
|
||||
@@ -318,12 +325,6 @@ SWAGGER_SETTINGS = {
|
||||
|
||||
AJAX_REDIRECT_CODE = 278
|
||||
|
||||
# ----- Celery -----
|
||||
|
||||
BROKER_URL = get_environment_setting(name='BROKER_URL')
|
||||
CELERY_ALWAYS_EAGER = get_environment_setting(name='CELERY_ALWAYS_EAGER')
|
||||
CELERY_RESULT_BACKEND = get_environment_setting(name='CELERY_RESULT_BACKEND')
|
||||
|
||||
# ----- Database -----
|
||||
DATABASES = {
|
||||
'default': {
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from mayan.apps.smart_settings.utils import get_environment_setting
|
||||
|
||||
from . import * # NOQA
|
||||
|
||||
ALLOWED_HOSTS = ['*']
|
||||
|
||||
DEBUG = True
|
||||
|
||||
CELERY_ALWAYS_EAGER = True
|
||||
CELERY_EAGER_PROPAGATES_EXCEPTIONS = CELERY_ALWAYS_EAGER
|
||||
CELERY_TASK_ALWAYS_EAGER = get_environment_setting(
|
||||
name='CELERY_TASK_ALWAYS_EAGER', fallback_default='true'
|
||||
)
|
||||
CELERY_TASK_EAGER_PROPAGATES = CELERY_TASK_ALWAYS_EAGER
|
||||
|
||||
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
|
||||
|
||||
|
||||
if 'rosetta' not in INSTALLED_APPS:
|
||||
try:
|
||||
import rosetta
|
||||
|
||||
@@ -2,7 +2,7 @@ from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from . import * # NOQA
|
||||
|
||||
CELERY_ALWAYS_EAGER = False
|
||||
CELERY_TASK_ALWAYS_EAGER = False
|
||||
|
||||
TEMPLATES[0]['OPTIONS']['loaders'] = (
|
||||
(
|
||||
|
||||
@@ -12,6 +12,6 @@ DATABASES = {
|
||||
}
|
||||
}
|
||||
|
||||
BROKER_URL = 'redis://127.0.0.1:6379/0'
|
||||
CELERY_BROKER_URL = 'redis://127.0.0.1:6379/0'
|
||||
CELERY_RESULT_BACKEND = 'redis://127.0.0.1:6379/0'
|
||||
DEBUG = True
|
||||
|
||||
@@ -2,8 +2,8 @@ from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from .. import * # NOQA
|
||||
|
||||
CELERY_ALWAYS_EAGER = True
|
||||
CELERY_EAGER_PROPAGATES_EXCEPTIONS = True
|
||||
CELERY_TASK_ALWAYS_EAGER = True
|
||||
CELERY_TASK_EAGER_PROPAGATES = True
|
||||
BROKER_BACKEND = 'memory'
|
||||
|
||||
COMMON_PRODUCTION_ERROR_LOG_PATH = '/tmp/mayan-errors.log'
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Packages to be remove during upgrades
|
||||
cssmin
|
||||
django-autoadmin
|
||||
django-celery
|
||||
django-environ
|
||||
django-suit
|
||||
django-compressor
|
||||
|
||||
Reference in New Issue
Block a user