Merge pull request #863 from alphagov/create-dvla-file

Added logging for any exception thrown in build_dvla_file
This commit is contained in:
Rebecca Law
2017-03-17 17:37:17 +00:00
committed by GitHub

View File

@@ -265,6 +265,7 @@ def persist_letter(
@notify_celery.task(bind=True, name="build-dvla-file", max_retries=15, default_retry_delay=300) @notify_celery.task(bind=True, name="build-dvla-file", max_retries=15, default_retry_delay=300)
@statsd(namespace="tasks") @statsd(namespace="tasks")
def build_dvla_file(self, job_id): def build_dvla_file(self, job_id):
try:
if all_notifications_are_created_for_job(job_id): if all_notifications_are_created_for_job(job_id):
notifications = dao_get_all_notifications_for_job(job_id) notifications = dao_get_all_notifications_for_job(job_id)
file = "" file = ""
@@ -281,6 +282,9 @@ def build_dvla_file(self, job_id):
else: else:
current_app.logger.info("All notifications for job {} are not persisted".format(job_id)) current_app.logger.info("All notifications for job {} are not persisted".format(job_id))
self.retry(queue="retry", exc="All notifications for job {} are not persisted".format(job_id)) self.retry(queue="retry", exc="All notifications for job {} are not persisted".format(job_id))
except Exception as e:
current_app.logger.exception("build_dvla_file threw exception")
raise e
def s3upload(filedata, region, bucket_name, file_location): def s3upload(filedata, region, bucket_name, file_location):