From 787d0da7dbcee51f04542e1e8c6449a1f4410eb3 Mon Sep 17 00:00:00 2001 From: Martyn Inglis Date: Tue, 4 Apr 2017 11:23:54 +0100 Subject: [PATCH] Broke the periodic queue out from the standard worker. - now has own worker with worker count of 2 - this is too ensure that any issues with scheduled jobs do not affect core applications --- app/config.py | 13 +++++++------ manifest-delivery-base.yml | 5 +++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/app/config.py b/app/config.py index 619532d3d..5b3e7e309 100644 --- a/app/config.py +++ b/app/config.py @@ -119,17 +119,17 @@ class Config(object): }, 'delete-failed-notifications': { 'task': 'delete-failed-notifications', - 'schedule': crontab(minute=15, hour='0,1,2'), + 'schedule': crontab(minute=0, hour=0), 'options': {'queue': 'periodic'} }, 'delete-successful-notifications': { 'task': 'delete-successful-notifications', - 'schedule': crontab(minute=0, hour='0,1,2'), + 'schedule': crontab(minute=0, hour=1), 'options': {'queue': 'periodic'} }, 'send-daily-performance-platform-stats': { 'task': 'send-daily-performance-platform-stats', - 'schedule': crontab(minute=0, hour=4), # 04:00 + 'schedule': crontab(minute=0, hour=2), 'options': {'queue': 'periodic'} }, 'switch-current-sms-provider-on-slow-delivery': { @@ -139,17 +139,16 @@ class Config(object): }, 'timeout-sending-notifications': { 'task': 'timeout-sending-notifications', - 'schedule': crontab(minute=30, hour='0,1,2'), + 'schedule': crontab(minute=0, hour=3), 'options': {'queue': 'periodic'} }, 'remove_csv_files': { 'task': 'remove_csv_files', - 'schedule': crontab(minute=45, hour='0,1,2'), + 'schedule': crontab(minute=0, hour=4), 'options': {'queue': 'periodic'} } } CELERY_QUEUES = [ - Queue('periodic', Exchange('default'), routing_key='periodic'), Queue('process-job', Exchange('default'), routing_key='process-job'), Queue('retry', Exchange('default'), routing_key='retry'), Queue('notify', Exchange('default'), routing_key='notify') @@ -191,6 +190,7 @@ class Development(Config): SQLALCHEMY_ECHO = False CELERY_QUEUES = Config.CELERY_QUEUES + [ Queue('db-sms', Exchange('default'), routing_key='db-sms'), + Queue('periodic', Exchange('default'), routing_key='periodic'), Queue('db-email', Exchange('default'), routing_key='db-email'), Queue('db-letter', Exchange('default'), routing_key='db-letter'), Queue('send-sms', Exchange('default'), routing_key='send-sms'), @@ -210,6 +210,7 @@ class Test(Config): STATSD_HOST = "localhost" STATSD_PORT = 1000 CELERY_QUEUES = Config.CELERY_QUEUES + [ + Queue('periodic', Exchange('default'), routing_key='periodic'), Queue('db-sms', Exchange('default'), routing_key='db-sms'), Queue('db-email', Exchange('default'), routing_key='db-email'), Queue('db-letter', Exchange('default'), routing_key='db-letter'), diff --git a/manifest-delivery-base.yml b/manifest-delivery-base.yml index b60916916..06f53a178 100644 --- a/manifest-delivery-base.yml +++ b/manifest-delivery-base.yml @@ -35,6 +35,11 @@ applications: env: NOTIFY_APP_NAME: delivery-worker-sender + - name: notify-delivery-worker-periodic + command: scripts/run_app_paas.sh celery -A aws_run_celery.notify_celery worker --loglevel=INFO --concurrency=2 -Q periodic + env: + NOTIFY_APP_NAME: delivery-worker + - name: notify-delivery-worker command: scripts/run_app_paas.sh celery -A aws_run_celery.notify_celery worker --loglevel=INFO --concurrency=11 env: