From 6318cd2a84c375a8e041310439f55a895dc8110d Mon Sep 17 00:00:00 2001 From: Leo Hemsted Date: Wed, 24 Jun 2020 12:41:56 +0100 Subject: [PATCH 1/2] remove whitespace from log line multi line strings don't handle indentation --- app/celery/tasks.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/celery/tasks.py b/app/celery/tasks.py index a78dbabdb..5444eb03e 100644 --- a/app/celery/tasks.py +++ b/app/celery/tasks.py @@ -597,11 +597,8 @@ def send_inbound_sms_to_service(self, inbound_sms_id, service_id): self.retry(queue=QueueNames.RETRY) except self.MaxRetriesExceededError: current_app.logger.error( - """Retry: send_inbound_sms_to_service has retried the max number of - times for service: {} and inbound_sms {}""".format( - service_id, - inbound_sms_id - ) + f"Retry: send_inbound_sms_to_service has retried the max number of" + + f"times for service: {service_id} and inbound_sms {inbound_sms_id}" ) From 616523bf746b4d4401d4d01000ee4bbb48dd781e Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Fri, 26 Jun 2020 10:14:32 +0100 Subject: [PATCH 2/2] Fix circular import MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We changed auth.py to import from app.serialised_models here: https://github.com/alphagov/notifications-api/pull/2887/files#diff-77cbb1e03185c7319f0311371c438b0cR11 `serialised_models.py` imports from `templates_dao.py` `templates_dao.py` imports from `users_dao.py` `users_dao.py` imports from `errors.py` `errors.py` imports from `auth.py` … and the circle is complete 💥 For some reason this caused the Celery workers to crash on startup, but not the app. Which I guess is why the integration tests didn’t catch this? --- app/serialised_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/serialised_models.py b/app/serialised_models.py index 7f88171d2..e47c8800c 100644 --- a/app/serialised_models.py +++ b/app/serialised_models.py @@ -9,7 +9,6 @@ from werkzeug.utils import cached_property from app import db, redis_store -from app.dao import templates_dao from app.dao.api_key_dao import get_model_api_keys from app.dao.services_dao import dao_fetch_service_by_id @@ -101,6 +100,7 @@ class SerialisedTemplate(SerialisedModel): @staticmethod @redis_cache.set('template-{template_id}-version-None') def get_dict(template_id, service_id): + from app.dao import templates_dao from app.schemas import template_schema fetched_template = templates_dao.dao_get_template_by_id_and_service_id(