mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-21 07:51:13 -05:00
Some pseudo code and notes of how to implement a check for the letter acknowledgement file.
This commit is contained in:
@@ -447,3 +447,22 @@ def daily_stats_template_usage_by_month():
|
|||||||
result.year,
|
result.year,
|
||||||
result.count
|
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
|
||||||
@@ -249,6 +249,11 @@ class Config(object):
|
|||||||
'schedule': crontab(hour=17, minute=50),
|
'schedule': crontab(hour=17, minute=50),
|
||||||
'options': {'queue': QueueNames.PERIODIC}
|
'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': {
|
'run-letter-api-notifications': {
|
||||||
'task': 'run-letter-api-notifications',
|
'task': 'run-letter-api-notifications',
|
||||||
'schedule': crontab(hour=17, minute=40),
|
'schedule': crontab(hour=17, minute=40),
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ def process_letter_response():
|
|||||||
message = json.loads(req_json['Message'])
|
message = json.loads(req_json['Message'])
|
||||||
filename = message['Records'][0]['s3']['object']['key']
|
filename = message['Records'][0]['s3']['object']['key']
|
||||||
current_app.logger.info('Received file from DVLA: {}'.format(filename))
|
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')
|
current_app.logger.info('DVLA callback: Calling task to update letter notifications')
|
||||||
update_letter_notifications_statuses.apply_async([filename], queue=QueueNames.NOTIFY)
|
update_letter_notifications_statuses.apply_async([filename], queue=QueueNames.NOTIFY)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user