mirror of
https://github.com/GSA/notifications-api.git
synced 2026-03-04 09:22:39 -05:00
Merge pull request #882 from alphagov/update-scheduled-jobs
Update scheduled jobs
This commit is contained in:
@@ -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,8 @@ class Development(Config):
|
||||
SQLALCHEMY_ECHO = False
|
||||
CELERY_QUEUES = Config.CELERY_QUEUES + [
|
||||
Queue('db-sms', Exchange('default'), routing_key='db-sms'),
|
||||
Queue('priority', Exchange('default'), routing_key='priority'),
|
||||
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 +211,8 @@ class Test(Config):
|
||||
STATSD_HOST = "localhost"
|
||||
STATSD_PORT = 1000
|
||||
CELERY_QUEUES = Config.CELERY_QUEUES + [
|
||||
Queue('periodic', Exchange('default'), routing_key='periodic'),
|
||||
Queue('priority', Exchange('default'), routing_key='priority'),
|
||||
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'),
|
||||
|
||||
@@ -131,7 +131,7 @@ def send_notification(notification_type):
|
||||
key_type=api_user.key_type,
|
||||
simulated=simulated)
|
||||
if not simulated:
|
||||
queue_name = 'notify' if template.process_type == PRIORITY else None
|
||||
queue_name = 'priority' if template.process_type == PRIORITY else None
|
||||
send_notification_to_queue(notification=notification_model,
|
||||
research_mode=service.research_mode,
|
||||
queue=queue_name)
|
||||
|
||||
@@ -50,7 +50,7 @@ def post_notification(notification_type):
|
||||
reference=form.get('reference', None),
|
||||
simulated=simulated)
|
||||
if not simulated:
|
||||
queue_name = 'notify' if template.process_type == PRIORITY else None
|
||||
queue_name = 'priority' if template.process_type == PRIORITY else None
|
||||
send_notification_to_queue(notification=notification, research_mode=service.research_mode, queue=queue_name)
|
||||
else:
|
||||
current_app.logger.info("POST simulated notification for id: {}".format(notification.id))
|
||||
|
||||
@@ -17,6 +17,8 @@ memory: 1G
|
||||
applications:
|
||||
- name: notify-delivery-celery-beat
|
||||
command: scripts/run_app_paas.sh celery -A aws_run_celery.notify_celery beat --loglevel=INFO
|
||||
instances: 1
|
||||
memory: 128M
|
||||
env:
|
||||
NOTIFY_APP_NAME: delivery-celery-beat
|
||||
|
||||
@@ -35,6 +37,18 @@ 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
|
||||
instances: 1
|
||||
memory: 2G
|
||||
env:
|
||||
NOTIFY_APP_NAME: delivery-worker-periodic
|
||||
|
||||
- name: notify-delivery-worker-priority
|
||||
command: scripts/run_app_paas.sh celery -A aws_run_celery.notify_celery worker --loglevel=INFO --concurrency=5 -Q priority
|
||||
env:
|
||||
NOTIFY_APP_NAME: delivery-worker-priority
|
||||
|
||||
- name: notify-delivery-worker
|
||||
command: scripts/run_app_paas.sh celery -A aws_run_celery.notify_celery worker --loglevel=INFO --concurrency=11
|
||||
env:
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
inherit: manifest-delivery-base.yml
|
||||
|
||||
instances: 2
|
||||
memory: 2G
|
||||
memory: 1G
|
||||
|
||||
@@ -1022,4 +1022,4 @@ def test_send_notification_uses_priority_queue_when_template_is_marked_as_priori
|
||||
notification_id = response_data['notification']['id']
|
||||
|
||||
assert response.status_code == 201
|
||||
mocked.assert_called_once_with([notification_id], queue='notify')
|
||||
mocked.assert_called_once_with([notification_id], queue='priority')
|
||||
|
||||
@@ -223,4 +223,4 @@ def test_send_notification_uses_priority_queue_when_template_is_marked_as_priori
|
||||
notification_id = json.loads(response.data)['id']
|
||||
|
||||
assert response.status_code == 201
|
||||
mocked.assert_called_once_with([notification_id], queue='notify')
|
||||
mocked.assert_called_once_with([notification_id], queue='priority')
|
||||
|
||||
Reference in New Issue
Block a user