Skip to content

Commit

Permalink
- Fix celery initialization when using GeoNode ad a depenency
Browse files Browse the repository at this point in the history
  • Loading branch information
afabiani committed Jun 28, 2018
1 parent 5a4db3d commit f6d61ff
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
7 changes: 2 additions & 5 deletions geonode/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,9 @@

def run_setup_hooks(*args, **kwargs):
from django.conf import settings
# from .celery_app import app as celery_app
from .celery_app import app as celery_app
if 'geonode.celery_app' not in settings.INSTALLED_APPS:
settings.INSTALLED_APPS += ('geonode.celery_app', )
if settings.USE_GEOSERVER and settings.ASYNC_SIGNALS:
from geonode.messaging.queues import QUEUES
settings.CELERY_TASK_QUEUES += QUEUES
settings.INSTALLED_APPS += (celery_app )


class AppConfig(BaseAppConfig):
Expand Down
3 changes: 2 additions & 1 deletion geonode/messaging/queues.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
#
#########################################################################

from django.conf import settings
from kombu import Exchange, Queue

geoserver_exchange = Exchange("geonode", type="topic", durable=False)
geoserver_exchange = settings.GEOSERVER_EXCHANGE

queue_all_events = Queue("broadcast", geoserver_exchange, routing_key="#")
queue_email_events = Queue("email.events", geoserver_exchange, routing_key="email")
Expand Down
14 changes: 11 additions & 3 deletions geonode/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -1321,9 +1321,17 @@
Queue('email', GEONODE_EXCHANGE, routing_key='email'),
)

# if USE_GEOSERVER and ASYNC_SIGNALS:
# from geonode.messaging.queues import QUEUES
# CELERY_TASK_QUEUES += QUEUES
if USE_GEOSERVER:
CELERY_TASK_QUEUES += (
Queue("broadcast", GEOSERVER_EXCHANGE, routing_key="#"),
Queue("email.events", GEOSERVER_EXCHANGE, routing_key="email"),
Queue("all.geoserver", GEOSERVER_EXCHANGE, routing_key="geoserver.#"),
Queue("geoserver.catalog", GEOSERVER_EXCHANGE, routing_key="geoserver.catalog"),
Queue("geoserver.data", GEOSERVER_EXCHANGE, routing_key="geoserver.catalog"),
Queue("geoserver.events", GEOSERVER_EXCHANGE, routing_key="geonode.geoserver"),
Queue("notifications.events", GEOSERVER_EXCHANGE, routing_key="notifications"),
Queue("geonode.layer.viewer", GEOSERVER_EXCHANGE, routing_key="geonode.viewer"),
)

# CELERYBEAT_SCHEDULE = {
# ...
Expand Down

0 comments on commit f6d61ff

Please sign in to comment.