mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-11 09:27:56 -04:00
remove duplication shutdown loggers
also add **kwargs to make it celery4 compatible
This commit is contained in:
@@ -1,6 +1,13 @@
|
||||
import time
|
||||
|
||||
from celery import Celery, Task
|
||||
from celery.signals import worker_process_shutdown
|
||||
from flask import current_app
|
||||
|
||||
|
||||
@worker_process_shutdown.connect
|
||||
def worker_process_shutdown(sender, signal, pid, exitcode, **kwargs):
|
||||
current_app.logger.info('worker shutdown: PID: {} Exitcode: {}'.format(pid, exitcode))
|
||||
|
||||
|
||||
def make_task(app):
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
from celery.signals import worker_process_shutdown
|
||||
from flask import current_app
|
||||
from notifications_utils.recipients import InvalidEmailError
|
||||
from notifications_utils.statsd_decorators import statsd
|
||||
@@ -13,11 +12,6 @@ from app.exceptions import NotificationTechnicalFailureException
|
||||
from app.models import NOTIFICATION_TECHNICAL_FAILURE
|
||||
|
||||
|
||||
@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):
|
||||
|
||||
@@ -5,7 +5,6 @@ from datetime import (
|
||||
)
|
||||
|
||||
import pytz
|
||||
from celery.signals import worker_process_shutdown
|
||||
from flask import current_app
|
||||
from notifications_utils.statsd_decorators import statsd
|
||||
from sqlalchemy import and_, func
|
||||
@@ -74,11 +73,6 @@ from app.utils import (
|
||||
from app.v2.errors import JobIncompleteError
|
||||
|
||||
|
||||
@worker_process_shutdown.connect
|
||||
def worker_process_shutdown(sender, signal, pid, exitcode):
|
||||
current_app.logger.info('Scheduled tasks worker shutdown: PID: {} Exitcode: {}'.format(pid, exitcode))
|
||||
|
||||
|
||||
@notify_celery.task(name="remove_csv_files")
|
||||
@statsd(namespace="tasks")
|
||||
def remove_csv_files(job_types):
|
||||
|
||||
@@ -2,9 +2,7 @@ import json
|
||||
from datetime import datetime
|
||||
from collections import namedtuple, defaultdict
|
||||
|
||||
from celery.signals import worker_process_shutdown
|
||||
from flask import current_app
|
||||
|
||||
from notifications_utils.recipients import (
|
||||
RecipientCSV
|
||||
)
|
||||
@@ -74,11 +72,6 @@ from app.service.utils import service_allowed_to_send_to
|
||||
from app.utils import convert_utc_to_bst
|
||||
|
||||
|
||||
@worker_process_shutdown.connect
|
||||
def worker_process_shutdown(sender, signal, pid, exitcode):
|
||||
current_app.logger.info('Tasks worker shutdown: PID: {} Exitcode: {}'.format(pid, exitcode))
|
||||
|
||||
|
||||
@notify_celery.task(name="process-job")
|
||||
@statsd(namespace="tasks")
|
||||
def process_job(job_id):
|
||||
|
||||
Reference in New Issue
Block a user