Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1"""Celery application initialization.""" 

2 

3from celery import Celery 

4 

5from ._version import get_versions 

6from .conf import playground 

7from . import email 

8from . import lvalert 

9from . import sentry 

10from . import voevent 

11 

12__all__ = ('app',) 

13 

14__version__ = get_versions()['version'] 

15del get_versions 

16 

17# Use redis broker, because it supports locks (and thus singleton tasks). 

18app = Celery(__name__, broker='redis://', autofinalize=False) 

19"""Celery application object.""" 

20 

21# Register email, LVAlert and VOEvent subsystems. 

22email.install(app) 

23lvalert.install(app) 

24voevent.install(app) 

25 

26# Register all tasks. 

27app.autodiscover_tasks([__name__]) 

28 

29# Add default configuration. 

30app.add_defaults(playground) 

31app.finalize() 

32 

33# Customize configuration from environment variable. 

34app.config_from_envvar('CELERY_CONFIG_MODULE', silent=True) 

35 

36# Use the same URL for both the result backend and the broker. 

37app.conf['result_backend'] = app.conf.broker_url 

38 

39sentry.configure()