New command to create-pdf-letter task for a given notification id.

After a notificaiton is created we create a task to create the pdf and save it to S3,
if for some reason that task does not run we are left with notifications that are not sent.
This should not happen, but if it does we have a way to continue sending the letter.
This commit is contained in:
Rebecca Law
2018-03-23 15:47:01 +00:00
parent 5d38989cd9
commit 6dad9b43db

View File

@@ -12,6 +12,7 @@ from sqlalchemy.orm.exc import NoResultFound
from app import db, DATETIME_FORMAT, encryption
from app.celery.scheduled_tasks import send_total_sent_notifications_to_performance_platform
from app.celery.service_callback_tasks import send_delivery_status_to_service
from app.celery.letters_pdf_tasks import create_letters_pdf
from app.config import QueueNames
from app.dao.monthly_billing_dao import (
create_or_update_monthly_billing,
@@ -316,6 +317,14 @@ def insert_inbound_numbers_from_file(file_name):
file.close()
@notify_command(name='replay-create-pdf-letters')
@click.option('-n', '--notification_id', required=True,
help="Notification id of the letter that needs the create_letters_pdf task replayed")
def replay_create_pdf_letters(notification_id):
print("Create task to create_letters_pdf for notification: {}".format(notification_id))
create_letters_pdf.apply_async([notification_id], queue=QueueNames.CREATE_LETTERS_PDF)
@notify_command(name='replay-service-callbacks')
@click.option('-f', '--file_name', required=True,
help="""Full path of the file to upload, file is a contains client references of