Some pseudo code and notes of how to implement a check for the letter acknowledgement file.

This commit is contained in:
Rebecca Law
2018-01-11 16:37:39 +00:00
parent 79a7355da7
commit 9c4e43bfac
3 changed files with 25 additions and 0 deletions

View File

@@ -447,3 +447,22 @@ def daily_stats_template_usage_by_month():
result.year,
result.count
)
@notify_celery.task(name='raise-alert-if-no-letter-ack-file')
@statsd(namespace="tasks")
def raise_alert_if_no_letter_ack_file():
"""
Get all files sent "today"
list_of_zip_files => get file names s3.get_s3_bucket_objects() look in the folder with todays date
list_of_ack_files => Get all files sent today with name containing ack.txt from a diff bucket
For filename in list_of_zip_files:
for ack_file in list_of_ack_files if name= file.strip("NOTIFY.", ".ZIP")
IF no ack_file
raise NoAckFileReceived(status=500, message="No ack file received for {filename}")
"""
pass

View File

@@ -249,6 +249,11 @@ class Config(object):
'schedule': crontab(hour=17, minute=50),
'options': {'queue': QueueNames.PERIODIC}
},
'raise-alert-if-no-letter-ack-file': {
'task': 'raise-alert-if-no-letter-ack-file',
'schedule': crontab(hour=19, minute=00),
'options': {'queue': QueueNames.PERIODIC}
},
'run-letter-api-notifications': {
'task': 'run-letter-api-notifications',
'schedule': crontab(hour=17, minute=40),

View File

@@ -53,6 +53,7 @@ def process_letter_response():
message = json.loads(req_json['Message'])
filename = message['Records'][0]['s3']['object']['key']
current_app.logger.info('Received file from DVLA: {}'.format(filename))
# IF file name contains .rs.txt THEN continue ELSE log message with file name. and return
current_app.logger.info('DVLA callback: Calling task to update letter notifications')
update_letter_notifications_statuses.apply_async([filename], queue=QueueNames.NOTIFY)