mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-19 14:08:47 -04:00
Remove unused methods
This commit is contained in:
@@ -20,7 +20,6 @@ from requests import (
|
||||
RequestException
|
||||
)
|
||||
from sqlalchemy.exc import SQLAlchemyError
|
||||
from botocore.exceptions import ClientError as BotoClientError
|
||||
|
||||
from app import (
|
||||
create_uuid,
|
||||
@@ -36,8 +35,6 @@ from app.dao.inbound_sms_dao import dao_get_inbound_sms_by_id
|
||||
from app.dao.jobs_dao import (
|
||||
dao_update_job,
|
||||
dao_get_job_by_id,
|
||||
all_notifications_are_created_for_job,
|
||||
dao_get_all_notifications_for_job,
|
||||
dao_update_job_status
|
||||
)
|
||||
from app.dao.notifications_dao import (
|
||||
@@ -60,7 +57,6 @@ from app.models import (
|
||||
JOB_STATUS_FINISHED,
|
||||
JOB_STATUS_IN_PROGRESS,
|
||||
JOB_STATUS_PENDING,
|
||||
JOB_STATUS_READY_TO_SEND,
|
||||
JOB_STATUS_SENT_TO_DVLA, JOB_STATUS_ERROR,
|
||||
KEY_TYPE_NORMAL,
|
||||
LETTER_TYPE,
|
||||
@@ -73,7 +69,6 @@ from app.models import (
|
||||
)
|
||||
from app.notifications.process_notifications import persist_notification
|
||||
from app.service.utils import service_allowed_to_send_to
|
||||
from notifications_utils.s3 import s3upload
|
||||
|
||||
|
||||
@worker_process_shutdown.connect
|
||||
@@ -335,29 +330,6 @@ def save_letter(
|
||||
handle_exception(self, notification, notification_id, e)
|
||||
|
||||
|
||||
@notify_celery.task(bind=True, name="build-dvla-file", countdown=60, max_retries=15, default_retry_delay=300)
|
||||
@statsd(namespace="tasks")
|
||||
def build_dvla_file(self, job_id):
|
||||
try:
|
||||
if all_notifications_are_created_for_job(job_id):
|
||||
file_contents = create_dvla_file_contents_for_job(job_id)
|
||||
s3upload(
|
||||
filedata=file_contents + '\n',
|
||||
region=current_app.config['AWS_REGION'],
|
||||
bucket_name=current_app.config['DVLA_BUCKETS']['job'],
|
||||
file_location="{}-dvla-job.text".format(job_id)
|
||||
)
|
||||
dao_update_job_status(job_id, JOB_STATUS_READY_TO_SEND)
|
||||
else:
|
||||
msg = "All notifications for job {} are not persisted".format(job_id)
|
||||
current_app.logger.info(msg)
|
||||
self.retry(queue=QueueNames.RETRY)
|
||||
# specifically don't catch celery.retry errors
|
||||
except (SQLAlchemyError, BotoClientError):
|
||||
current_app.logger.exception("build_dvla_file threw exception")
|
||||
self.retry(queue=QueueNames.RETRY)
|
||||
|
||||
|
||||
@notify_celery.task(bind=True, name='update-letter-job-to-sent')
|
||||
@statsd(namespace="tasks")
|
||||
def update_job_to_sent_to_dvla(self, job_id):
|
||||
@@ -414,12 +386,6 @@ def update_letter_notifications_to_error(self, notification_references):
|
||||
current_app.logger.debug("Updated {} letter notifications to technical-failure".format(updated_count))
|
||||
|
||||
|
||||
def create_dvla_file_contents_for_job(job_id):
|
||||
notifications = dao_get_all_notifications_for_job(job_id)
|
||||
|
||||
return create_dvla_file_contents_for_notifications(notifications)
|
||||
|
||||
|
||||
def create_dvla_file_contents_for_notifications(notifications):
|
||||
file_contents = '\n'.join(
|
||||
str(LetterDVLATemplate(
|
||||
|
||||
Reference in New Issue
Block a user