mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-20 14:29:25 -04:00
Adding extra logging to celery tasks ans gunicorn, specifically log on SIGTERM and SIGINIT so that we can track better when an app restarts and why it restarts e.g. when it restarts after another signal.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from celery.signals import worker_process_init, worker_process_shutdown, worker_shutdown
|
||||
from flask import current_app
|
||||
from notifications_utils.recipients import InvalidEmailError
|
||||
from sqlalchemy.orm.exc import NoResultFound
|
||||
@@ -10,6 +11,11 @@ from app.statsd_decorators import statsd
|
||||
from app.delivery import send_to_providers
|
||||
|
||||
|
||||
@worker_process_shutdown.connect
|
||||
def worker_process_shutdown(sender, signal, pid, exitcode):
|
||||
current_app.logger.info('Provider worker shutdown: PID: {} Exitcode: {}'.format(pid, exitcode))
|
||||
|
||||
|
||||
@notify_celery.task(bind=True, name="deliver_sms", max_retries=48, default_retry_delay=300)
|
||||
@statsd(namespace="tasks")
|
||||
def deliver_sms(self, notification_id):
|
||||
|
||||
Reference in New Issue
Block a user