mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-24 00:06:16 -04:00
Compare commits
1 Commits
a8060cec04
...
duplicate-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3007ff8f04 |
2
Makefile
2
Makefile
@@ -37,7 +37,7 @@ run-celery: ## Run celery
|
|||||||
-A run_celery.notify_celery worker \
|
-A run_celery.notify_celery worker \
|
||||||
--pidfile="/tmp/celery.pid" \
|
--pidfile="/tmp/celery.pid" \
|
||||||
--loglevel=INFO \
|
--loglevel=INFO \
|
||||||
--concurrency=4
|
--concurrency=2
|
||||||
|
|
||||||
.PHONY: run-celery-beat
|
.PHONY: run-celery-beat
|
||||||
run-celery-beat: ## Run celery beat
|
run-celery-beat: ## Run celery beat
|
||||||
|
|||||||
@@ -16,6 +16,12 @@ from app.dao.fact_notification_status_dao import (
|
|||||||
)
|
)
|
||||||
from app.models import EMAIL_TYPE, LETTER_TYPE, SMS_TYPE
|
from app.models import EMAIL_TYPE, LETTER_TYPE, SMS_TYPE
|
||||||
|
|
||||||
|
@notify_celery.task(name='long')
|
||||||
|
def long_task():
|
||||||
|
from time import sleep
|
||||||
|
current_app.logger.info("Running long_task")
|
||||||
|
sleep(20)
|
||||||
|
|
||||||
|
|
||||||
@notify_celery.task(name="create-nightly-billing")
|
@notify_celery.task(name="create-nightly-billing")
|
||||||
@cronitor("create-nightly-billing")
|
@cronitor("create-nightly-billing")
|
||||||
|
|||||||
@@ -192,7 +192,8 @@ class Config(object):
|
|||||||
'broker_url': 'sqs://',
|
'broker_url': 'sqs://',
|
||||||
'broker_transport_options': {
|
'broker_transport_options': {
|
||||||
'region': AWS_REGION,
|
'region': AWS_REGION,
|
||||||
'visibility_timeout': 310,
|
'visibility_timeout': 10,
|
||||||
|
'wait_time_seconds': 1,
|
||||||
'queue_name_prefix': NOTIFICATION_QUEUE_PREFIX,
|
'queue_name_prefix': NOTIFICATION_QUEUE_PREFIX,
|
||||||
},
|
},
|
||||||
'timezone': 'Europe/London',
|
'timezone': 'Europe/London',
|
||||||
@@ -343,10 +344,12 @@ class Config(object):
|
|||||||
# we can set celeryd_prefetch_multiplier to be 1 for celery apps which handle only long running tasks
|
# we can set celeryd_prefetch_multiplier to be 1 for celery apps which handle only long running tasks
|
||||||
if os.getenv('CELERYD_PREFETCH_MULTIPLIER'):
|
if os.getenv('CELERYD_PREFETCH_MULTIPLIER'):
|
||||||
CELERY['worker_prefetch_multiplier'] = os.getenv('CELERYD_PREFETCH_MULTIPLIER')
|
CELERY['worker_prefetch_multiplier'] = os.getenv('CELERYD_PREFETCH_MULTIPLIER')
|
||||||
|
CELERY['worker_prefetch_multiplier'] = 1
|
||||||
|
|
||||||
# on reporting worker, restart workers after each task is executed to help prevent memory leaks
|
# on reporting worker, restart workers after each task is executed to help prevent memory leaks
|
||||||
if os.getenv('CELERYD_MAX_TASKS_PER_CHILD'):
|
if os.getenv('CELERYD_MAX_TASKS_PER_CHILD'):
|
||||||
CELERY['worker_max_tasks_per_child'] = int(os.getenv('CELERYD_MAX_TASKS_PER_CHILD'))
|
CELERY['worker_max_tasks_per_child'] = int(os.getenv('CELERYD_MAX_TASKS_PER_CHILD'))
|
||||||
|
CELERY['worker_max_tasks_per_child'] = 1
|
||||||
|
|
||||||
FROM_NUMBER = 'development'
|
FROM_NUMBER = 'development'
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import pycurl
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
|
|
||||||
# notify_celery is referenced from manifest_delivery_base.yml, and cannot be removed
|
# notify_celery is referenced from manifest_delivery_base.yml, and cannot be removed
|
||||||
|
|||||||
Reference in New Issue
Block a user