Commit 1d0aa28582f8226ee51fbbd1857814e5a5b55d9b

Authored by Etienne Pallier
1 parent e93000d5
Exists in dev

Bye Bye Celery (3 - from settings)

Showing 1 changed file with 2 additions and 72 deletions   Show diff stats
src/pyros/settings.py
... ... @@ -16,19 +16,11 @@ https://docs.djangoproject.com/en/1.9/ref/settings/
16 16 # FOR SIMULATOR (TODO: remove because not used)
17 17 SIMULATOR = False
18 18  
19   -# FOR SIMULATOR (and TESTS)
20   -CELERY_TEST = False
21   -
22 19 # For majordome_test.py:
23 20 # cd src/majordome/
24 21 # ./majordome_test.py
25 22 MAJORDOME_TEST = False
26 23  
27   -# (EP) Remove this the day we succeed to use no more of Celery...
28   -# Set this to False if you want to run pyros without using Celery (and RabbitMQ)
29   -USE_CELERY = False
30   -#USE_CELERY = True
31   -
32 24 # Set MYSQL to False if you want to use SQLITE
33 25 # This line MUST NOT be changed at all except from changing True/False
34 26 # (or install_requirements script will become invalid)
... ... @@ -172,8 +164,8 @@ else:
172 164 }
173 165 }
174 166  
175   -# CELERY_TEST==True ==> 'TEST' RUN MODE, use pyros_test database
176   -if CELERY_TEST:
  167 +# SIMULATOR==True ==> 'TEST (simu)' RUN MODE, use pyros_test database
  168 +if SIMULATOR:
177 169 DATABASES = {
178 170 'default': {
179 171 'OPTIONS': mysql_options,
... ... @@ -236,7 +228,6 @@ USE_L10N = True
236 228 # Necessary for ENV monitoring :
237 229 USE_TZ = False
238 230 #USE_TZ = True
239   -#if USE_CELERY: USE_TZ = True
240 231  
241 232 # To find the media files {{ MEDIA_URL }}
242 233 MEDIA_URL = '/public/static/media/'
... ... @@ -280,64 +271,3 @@ else:
280 271  
281 272 # from django.core.cache import cache
282 273 # cache.clear()
283   -
284   -# CELERY CONFIG
285   -
286   -CELERY_RESULT_BACKEND = 'amqp'
287   -#CELERY_RESULT_BACKEND = 'rpc://'
288   -#CELERY_RESULT_BACKEND='djcelery.backends.database:DatabaseBackend',
289   -
290   -# (EP) TODO: This should also be added (according to https://simpleisbetterthancomplex.com/tutorial/2017/08/20/how-to-use-celery-with-django.html)
291   -#CELERY_BROKER_URL = 'amqp://localhost'
292   -#CELERY_BROKER_URL = 'amqp://guest:guest@localhost:5672/'
293   -#CELERY_BROKER_URL = 'django://'
294   -
295   -CELERY_ACCEPT_CONTENT = ['json']
296   -CELERY_TASK_SERIALIZER = 'json'
297   -CELERY_RESULT_SERIALIZER = 'json'
298   -
299   -# EP TODO: no more necessary, to be removed
300   -CELERY_IMPORTS = (
301   - "alert_manager.tasks",
302   - "analyzer.tasks",
303   - "majordome.tasks",
304   - "monitoring.tasks",
305   - "observation_manager.tasks",
306   - "scheduler.tasks",
307   -)
308   - # "userSimulator.tasks",
309   -
310   -# This config allows only 1 process / queue. We replace it by the -c option at celery workers creation.
311   -# CELERYD_CONCURRENCY = 1
312   -
313   -''' Following config is needed for manual purge '''
314   -CELERY_ACKS_LATE = False
315   -CELERYD_PREFETCH_MULTIPLIER = 1
316   -
317   -CELERY_QUEUES = {
318   - "alert_listener_q": {"exchange": "alert_listener_q", "routing_key": "alert_listener_q"},
319   - "monitoring_q": {"exchange": "monitoring_q", "routing_key": "monitoring_q"},
320   - "majordome_q": {"exchange": "majordome_q", "routing_key": "majordome_q"},
321   - "analysis_q": {"exchange": "analysis_q", "routing_key": "analysis_q"},
322   - "scheduling_q": {"exchange": "scheduling_q", "routing_key": "scheduling_q"},
323   - "create_calibrations_q": {"exchange": "create_calibrations_q", "routing_key": "create_calibrations_q"},
324   - "execute_plan_vis_q": {"exchange": "execute_plan_vis_q", "routing_key": "execute_plan_vis_q"},
325   - "execute_plan_nir_q": {"exchange": "execute_plan_nir_q", "routing_key": "execute_plan_nir_q"},
326   - "night_calibrations_q": {"exchange": "night_calibrations_q", "routing_key": "night_calibrations_q"},
327   -}
328   -
329   -CELERY_ROUTES = {
330   - "alert_manager.tasks.AlertListener": {"queue": "alert_listener_q"},
331   - "majordome.tasks.Majordome": {"queue": "majordome_q"},
332   - "monitoring.tasks.Monitoring": {"queue": "monitoring_q"},
333   - "analyzer.tasks.analysis": {"queue": "analysis_q"},
334   - "observation_manager.tasks.execute_plan_vis": {"queue": "execute_plan_vis_q"},
335   - "observation_manager.tasks.execute_plan_nir": {"queue": "execute_plan_nir_q"},
336   - "observation_manager.tasks.create_calibrations": {"queue": "create_calibrations_q"},
337   - "observation_manager.tasks.night_calibrations": {"queue": "night_calibrations_q"},
338   - "scheduler.tasks.scheduling": {"queue": "scheduling_q"}
339   -}
340   - # "userSimulator.tasks.simulator": {"queue": "simulator_q"},
341   -
342   -''' Removes pickle warning '''
343   -CELERY_ACCEPT_CONTENT = ['pickle', 'json', 'msgpack', 'yaml']
... ...