diff --git a/app/__init__.py b/app/__init__.py index dd4d89b2c..932e9c069 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -60,6 +60,7 @@ performance_platform_client = PerformancePlatformClient() cbc_proxy_client = CBCProxyClient() document_download_client = DocumentDownloadClient() metrics = GDSMetrics() +counter = 0 notification_provider_clients = NotificationProviderClients() diff --git a/app/celery/canary_tasks.py b/app/celery/canary_tasks.py new file mode 100644 index 000000000..dd4e13314 --- /dev/null +++ b/app/celery/canary_tasks.py @@ -0,0 +1,19 @@ +from flask import current_app +from notifications_utils.statsd_decorators import statsd + +from app import counter, notify_celery + + +@statsd(namespace="tasks") +def canary_passing_task(): + global counter + counter += 1 + + current_app.logger.info(f'The counter is {counter}.') + + +@notify_celery.task(name="canary_failing_task", max_retries=60, default_retry_delay=30) +@statsd(namespace="tasks") +def canary_failing_task(): + current_app.logger.info('Calling the failing task') + raise Exception diff --git a/manifest.yml.j2 b/manifest.yml.j2 index 6f7d16062..19f8a34a2 100644 --- a/manifest.yml.j2 +++ b/manifest.yml.j2 @@ -68,6 +68,7 @@ 'notify-delivery-worker-receipts': {}, 'notify-delivery-worker-service-callbacks': {'disk_quota': '2G'}, 'notify-delivery-worker-save-api-notifications': {'disk_quota': '2G'}, + 'notify-delivery-worker-canary': {'disk_quota': '2G'}, } -%} {%- set app = app_vars[CF_APP] -%} diff --git a/scripts/paas_app_wrapper.sh b/scripts/paas_app_wrapper.sh index 989327cf0..7bbe37f52 100755 --- a/scripts/paas_app_wrapper.sh +++ b/scripts/paas_app_wrapper.sh @@ -57,6 +57,10 @@ case $NOTIFY_APP_NAME in exec scripts/run_app_paas.sh celery -A run_celery.notify_celery worker --loglevel=INFO --concurrency=11 \ -Q save-api-email-tasks,save-api-sms-tasks 2> /dev/null ;; + delivery-worker-canary) + exec scripts/run_app_paas.sh celery -A run_celery.notify_celery worker --loglevel=INFO --concurrency=11 \ + -Q canary-a,canary-b 2> /dev/null + ;; delivery-celery-beat) exec scripts/run_app_paas.sh celery -A run_celery.notify_celery beat --loglevel=INFO ;;