From e1382989c3ea6ef73e7efaf09ef8c42d49febbe3 Mon Sep 17 00:00:00 2001 From: Andrew Shumway Date: Tue, 16 Apr 2024 14:51:11 -0600 Subject: [PATCH 1/9] poetry lock --- poetry.lock | 1 + 1 file changed, 1 insertion(+) diff --git a/poetry.lock b/poetry.lock index 1a322847b..5bc0e4ade 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2071,6 +2071,7 @@ files = [ {file = "lxml-5.2.1-cp36-cp36m-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c38d7b9a690b090de999835f0443d8aa93ce5f2064035dfc48f27f02b4afc3d0"}, {file = "lxml-5.2.1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5670fb70a828663cc37552a2a85bf2ac38475572b0e9b91283dc09efb52c41d1"}, {file = "lxml-5.2.1-cp36-cp36m-manylinux_2_28_x86_64.whl", hash = "sha256:958244ad566c3ffc385f47dddde4145088a0ab893504b54b52c041987a8c1863"}, + {file = "lxml-5.2.1-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:b6241d4eee5f89453307c2f2bfa03b50362052ca0af1efecf9fef9a41a22bb4f"}, {file = "lxml-5.2.1-cp36-cp36m-musllinux_1_1_aarch64.whl", hash = "sha256:2a66bf12fbd4666dd023b6f51223aed3d9f3b40fef06ce404cb75bafd3d89536"}, {file = "lxml-5.2.1-cp36-cp36m-musllinux_1_1_ppc64le.whl", hash = "sha256:9123716666e25b7b71c4e1789ec829ed18663152008b58544d95b008ed9e21e9"}, {file = "lxml-5.2.1-cp36-cp36m-musllinux_1_1_s390x.whl", hash = "sha256:0c3f67e2aeda739d1cc0b1102c9a9129f7dc83901226cc24dd72ba275ced4218"}, From 16a7bee93eac7c8e6759dd3e3688a886b70795bd Mon Sep 17 00:00:00 2001 From: Andrew Shumway Date: Mon, 22 Apr 2024 10:47:00 -0600 Subject: [PATCH 2/9] poetry lock --- poetry.lock | 1 - 1 file changed, 1 deletion(-) diff --git a/poetry.lock b/poetry.lock index f64aebdac..e4ad04a43 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2490,7 +2490,6 @@ files = [ {file = "msgpack-1.0.8-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:5fbb160554e319f7b22ecf530a80a3ff496d38e8e07ae763b9e82fadfe96f273"}, {file = "msgpack-1.0.8-cp39-cp39-win32.whl", hash = "sha256:f9af38a89b6a5c04b7d18c492c8ccf2aee7048aff1ce8437c4683bb5a1df893d"}, {file = "msgpack-1.0.8-cp39-cp39-win_amd64.whl", hash = "sha256:ed59dd52075f8fc91da6053b12e8c89e37aa043f8986efd89e61fae69dc1b011"}, - {file = "msgpack-1.0.8-py3-none-any.whl", hash = "sha256:24f727df1e20b9876fa6e95f840a2a2651e34c0ad147676356f4bf5fbb0206ca"}, {file = "msgpack-1.0.8.tar.gz", hash = "sha256:95c02b0e27e706e48d0e5426d1710ca78e0f0628d6e89d5b5a5b91a5f12274f3"}, ] From ed61be8736693df30e6474a266a192ccd665588b Mon Sep 17 00:00:00 2001 From: Andrew Shumway Date: Wed, 24 Apr 2024 09:30:37 -0600 Subject: [PATCH 3/9] Poetry lock --- poetry.lock | 1 - 1 file changed, 1 deletion(-) diff --git a/poetry.lock b/poetry.lock index bc810f891..947e6a4ab 100644 --- a/poetry.lock +++ b/poetry.lock @@ -3531,7 +3531,6 @@ files = [ {file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"}, {file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"}, {file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"}, - {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a08c6f0fe150303c1c6b71ebcd7213c2858041a7e01975da3a99aed1e7a378ef"}, {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"}, {file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"}, {file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"}, From bd5f43d28fbd7f5e34fdc3e92e37b5baa24a5f04 Mon Sep 17 00:00:00 2001 From: Andrew Shumway Date: Fri, 26 Apr 2024 10:16:04 -0600 Subject: [PATCH 4/9] poetry lock --- poetry.lock | 1 - 1 file changed, 1 deletion(-) diff --git a/poetry.lock b/poetry.lock index 5f002b800..947e6a4ab 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2490,7 +2490,6 @@ files = [ {file = "msgpack-1.0.8-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:5fbb160554e319f7b22ecf530a80a3ff496d38e8e07ae763b9e82fadfe96f273"}, {file = "msgpack-1.0.8-cp39-cp39-win32.whl", hash = "sha256:f9af38a89b6a5c04b7d18c492c8ccf2aee7048aff1ce8437c4683bb5a1df893d"}, {file = "msgpack-1.0.8-cp39-cp39-win_amd64.whl", hash = "sha256:ed59dd52075f8fc91da6053b12e8c89e37aa043f8986efd89e61fae69dc1b011"}, - {file = "msgpack-1.0.8-py3-none-any.whl", hash = "sha256:24f727df1e20b9876fa6e95f840a2a2651e34c0ad147676356f4bf5fbb0206ca"}, {file = "msgpack-1.0.8.tar.gz", hash = "sha256:95c02b0e27e706e48d0e5426d1710ca78e0f0628d6e89d5b5a5b91a5f12274f3"}, ] From 1e1a6dffd7544092029769c903f195a53c4cf747 Mon Sep 17 00:00:00 2001 From: Andrew Shumway Date: Fri, 10 May 2024 10:26:10 -0600 Subject: [PATCH 5/9] poetry lock --- poetry.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/poetry.lock b/poetry.lock index ca8dde032..6c78a7bf7 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. [[package]] name = "aiohttp" @@ -2096,6 +2096,7 @@ files = [ {file = "lxml-5.2.1-cp37-cp37m-musllinux_1_2_x86_64.whl", hash = "sha256:9e2addd2d1866fe112bc6f80117bcc6bc25191c5ed1bfbcf9f1386a884252ae8"}, {file = "lxml-5.2.1-cp37-cp37m-win32.whl", hash = "sha256:f51969bac61441fd31f028d7b3b45962f3ecebf691a510495e5d2cd8c8092dbd"}, {file = "lxml-5.2.1-cp37-cp37m-win_amd64.whl", hash = "sha256:b0b58fbfa1bf7367dde8a557994e3b1637294be6cf2169810375caf8571a085c"}, + {file = "lxml-5.2.1-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:3e183c6e3298a2ed5af9d7a356ea823bccaab4ec2349dc9ed83999fd289d14d5"}, {file = "lxml-5.2.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:804f74efe22b6a227306dd890eecc4f8c59ff25ca35f1f14e7482bbce96ef10b"}, {file = "lxml-5.2.1-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:08802f0c56ed150cc6885ae0788a321b73505d2263ee56dad84d200cab11c07a"}, {file = "lxml-5.2.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0f8c09ed18ecb4ebf23e02b8e7a22a05d6411911e6fabef3a36e4f371f4f2585"}, @@ -3527,7 +3528,6 @@ files = [ {file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"}, {file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"}, {file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"}, - {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a08c6f0fe150303c1c6b71ebcd7213c2858041a7e01975da3a99aed1e7a378ef"}, {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"}, {file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"}, {file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"}, From 50d7b9a7be8e167a2808abaeeee9085e01c5214e Mon Sep 17 00:00:00 2001 From: Andrew Shumway Date: Mon, 3 Jun 2024 15:53:59 -0600 Subject: [PATCH 6/9] poetry lock --- poetry.lock | 1 - 1 file changed, 1 deletion(-) diff --git a/poetry.lock b/poetry.lock index 3d7ce6e10..b3a8cd492 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2493,7 +2493,6 @@ files = [ {file = "msgpack-1.0.8-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:5fbb160554e319f7b22ecf530a80a3ff496d38e8e07ae763b9e82fadfe96f273"}, {file = "msgpack-1.0.8-cp39-cp39-win32.whl", hash = "sha256:f9af38a89b6a5c04b7d18c492c8ccf2aee7048aff1ce8437c4683bb5a1df893d"}, {file = "msgpack-1.0.8-cp39-cp39-win_amd64.whl", hash = "sha256:ed59dd52075f8fc91da6053b12e8c89e37aa043f8986efd89e61fae69dc1b011"}, - {file = "msgpack-1.0.8-py3-none-any.whl", hash = "sha256:24f727df1e20b9876fa6e95f840a2a2651e34c0ad147676356f4bf5fbb0206ca"}, {file = "msgpack-1.0.8.tar.gz", hash = "sha256:95c02b0e27e706e48d0e5426d1710ca78e0f0628d6e89d5b5a5b91a5f12274f3"}, ] From ce729c2f26ba962320abea4c957f1960cea4cecc Mon Sep 17 00:00:00 2001 From: Andrew Shumway Date: Wed, 10 Jul 2024 11:03:06 -0600 Subject: [PATCH 7/9] pull main --- poetry.lock | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/poetry.lock b/poetry.lock index e5a07c733..1e10ead84 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2098,9 +2098,13 @@ files = [ {file = "lxml-5.2.2-cp36-cp36m-win_amd64.whl", hash = "sha256:edcfa83e03370032a489430215c1e7783128808fd3e2e0a3225deee278585196"}, {file = "lxml-5.2.2-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:28bf95177400066596cdbcfc933312493799382879da504633d16cf60bba735b"}, {file = "lxml-5.2.2-cp37-cp37m-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3a745cc98d504d5bd2c19b10c79c61c7c3df9222629f1b6210c0368177589fb8"}, + {file = "lxml-5.2.2-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1b590b39ef90c6b22ec0be925b211298e810b4856909c8ca60d27ffbca6c12e6"}, {file = "lxml-5.2.2-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b336b0416828022bfd5a2e3083e7f5ba54b96242159f83c7e3eebaec752f1716"}, + {file = "lxml-5.2.2-cp37-cp37m-manylinux_2_28_aarch64.whl", hash = "sha256:c2faf60c583af0d135e853c86ac2735ce178f0e338a3c7f9ae8f622fd2eb788c"}, {file = "lxml-5.2.2-cp37-cp37m-manylinux_2_28_x86_64.whl", hash = "sha256:4bc6cb140a7a0ad1f7bc37e018d0ed690b7b6520ade518285dc3171f7a117905"}, + {file = "lxml-5.2.2-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:7ff762670cada8e05b32bf1e4dc50b140790909caa8303cfddc4d702b71ea184"}, {file = "lxml-5.2.2-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:57f0a0bbc9868e10ebe874e9f129d2917750adf008fe7b9c1598c0fbbfdde6a6"}, + {file = "lxml-5.2.2-cp37-cp37m-musllinux_1_2_aarch64.whl", hash = "sha256:a6d2092797b388342c1bc932077ad232f914351932353e2e8706851c870bca1f"}, {file = "lxml-5.2.2-cp37-cp37m-musllinux_1_2_x86_64.whl", hash = "sha256:60499fe961b21264e17a471ec296dcbf4365fbea611bf9e303ab69db7159ce61"}, {file = "lxml-5.2.2-cp37-cp37m-win32.whl", hash = "sha256:d9b342c76003c6b9336a80efcc766748a333573abf9350f4094ee46b006ec18f"}, {file = "lxml-5.2.2-cp37-cp37m-win_amd64.whl", hash = "sha256:b16db2770517b8799c79aa80f4053cd6f8b716f21f8aca962725a9565ce3ee40"}, @@ -2489,7 +2493,6 @@ files = [ {file = "msgpack-1.0.8-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:5fbb160554e319f7b22ecf530a80a3ff496d38e8e07ae763b9e82fadfe96f273"}, {file = "msgpack-1.0.8-cp39-cp39-win32.whl", hash = "sha256:f9af38a89b6a5c04b7d18c492c8ccf2aee7048aff1ce8437c4683bb5a1df893d"}, {file = "msgpack-1.0.8-cp39-cp39-win_amd64.whl", hash = "sha256:ed59dd52075f8fc91da6053b12e8c89e37aa043f8986efd89e61fae69dc1b011"}, - {file = "msgpack-1.0.8-py3-none-any.whl", hash = "sha256:24f727df1e20b9876fa6e95f840a2a2651e34c0ad147676356f4bf5fbb0206ca"}, {file = "msgpack-1.0.8.tar.gz", hash = "sha256:95c02b0e27e706e48d0e5426d1710ca78e0f0628d6e89d5b5a5b91a5f12274f3"}, ] From bba3fb1d73d0edbb94500e79fb5f205ca5555682 Mon Sep 17 00:00:00 2001 From: Andrew Shumway Date: Wed, 17 Jul 2024 07:46:00 -0600 Subject: [PATCH 8/9] Debug --- app/aws/s3.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/app/aws/s3.py b/app/aws/s3.py index 9466e6cce..b844ec134 100644 --- a/app/aws/s3.py +++ b/app/aws/s3.py @@ -1,5 +1,7 @@ import re +import csv +from app.utils import hilite import botocore from boto3 import Session from expiringdict import ExpiringDict @@ -124,17 +126,31 @@ def extract_phones(job): def extract_personalisation(job): + print(hilite(f"job type: {type(job)}")) + print(hilite(f"Job? {job}")) + job = job.split("\r\n") + print(hilite(f"job after first split: {job}")) first_row = job[0] + print(hilite(f"first_row: {first_row}")) job.pop(0) first_row = first_row.split(",") + print(hilite(f"first_row again: {first_row}")) personalisation = {} job_row = 0 + + row_csv_module = csv.reader(job) + for row_module in row_csv_module: + print(hilite(f"CSV MODULE ROW: {row_module}")) + for row in job: row = row.split(",") + print(hilite(f"row: {row}")) temp = dict(zip(first_row, row)) personalisation[job_row] = temp job_row = job_row + 1 + print(hilite(f"job_row: {job_row}")) + print(hilite(f"personalisation: {personalisation}")) return personalisation @@ -190,6 +206,7 @@ def get_personalisation_from_s3(service_id, job_id, job_row_number): job = JOBS.get(job_id) if job is None: job = get_job_from_s3(service_id, job_id) + print(hilite(f"job at the beginning: {job}")) JOBS[job_id] = job incr_jobs_cache_misses() else: From e956ca5017da642778d1a2eab386215f7636fd4b Mon Sep 17 00:00:00 2001 From: Andrew Shumway Date: Tue, 23 Jul 2024 13:37:52 -0600 Subject: [PATCH 9/9] Add more debug --- app/aws/s3.py | 7 ++----- app/celery/provider_tasks.py | 4 ++-- app/celery/tasks.py | 1 + app/clients/sms/aws_sns.py | 3 ++- app/delivery/send_to_providers.py | 2 ++ app/job/rest.py | 3 ++- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/app/aws/s3.py b/app/aws/s3.py index b844ec134..b57570e29 100644 --- a/app/aws/s3.py +++ b/app/aws/s3.py @@ -138,15 +138,12 @@ def extract_personalisation(job): print(hilite(f"first_row again: {first_row}")) personalisation = {} job_row = 0 - row_csv_module = csv.reader(job) - for row_module in row_csv_module: - print(hilite(f"CSV MODULE ROW: {row_module}")) - for row in job: - row = row.split(",") + for row in row_csv_module: print(hilite(f"row: {row}")) temp = dict(zip(first_row, row)) + print(hilite(f"temp: {temp}")) personalisation[job_row] = temp job_row = job_row + 1 print(hilite(f"job_row: {job_row}")) diff --git a/app/celery/provider_tasks.py b/app/celery/provider_tasks.py index 7d32c9326..44bda2b91 100644 --- a/app/celery/provider_tasks.py +++ b/app/celery/provider_tasks.py @@ -18,7 +18,7 @@ from app.delivery import send_to_providers from app.enums import NotificationStatus from app.exceptions import NotificationTechnicalFailureException -from app.utils import utc_now +from app.utils import hilite, utc_now # This is the amount of time to wait after sending an sms message before we check the aws logs and look for delivery # receipts @@ -100,7 +100,7 @@ def deliver_sms(self, notification_id): notification = notifications_dao.get_notification_by_id(notification_id) ansi_green = "\033[32m" ansi_reset = "\033[0m" - + print(hilite(f"notification inside of deliver_sms: {notification}")) if not notification: raise NoResultFound() if ( diff --git a/app/celery/tasks.py b/app/celery/tasks.py index f0d036549..17703c5dd 100644 --- a/app/celery/tasks.py +++ b/app/celery/tasks.py @@ -170,6 +170,7 @@ def __total_sending_limits_for_job_exceeded(service, job, job_id): def save_sms(self, service_id, notification_id, encrypted_notification, sender_id=None): """Persist notification to db and place notification in queue to send to sns.""" notification = encryption.decrypt(encrypted_notification) + print(hilite(f"notification at the top of save_sms: {notification}")) # SerialisedService and SerialisedTemplate classes are # used here to grab the same service and template from the cache # to improve performance. diff --git a/app/clients/sms/aws_sns.py b/app/clients/sms/aws_sns.py index e1c872665..948a98ed1 100644 --- a/app/clients/sms/aws_sns.py +++ b/app/clients/sms/aws_sns.py @@ -2,6 +2,7 @@ import re from time import monotonic +from app.utils import hilite import botocore import phonenumbers from boto3 import client @@ -54,7 +55,7 @@ def send_sms(self, to, content, reference, sender=None, international=False): to = phonenumbers.format_number( match.number, phonenumbers.PhoneNumberFormat.E164 ) - + print(hilite(f"to in send_sms: {to}")) # See documentation # https://docs.aws.amazon.com/sns/latest/dg/sms_publish-to-phone.html#sms_publish_sdk attributes = { diff --git a/app/delivery/send_to_providers.py b/app/delivery/send_to_providers.py index c0d32bf86..5429dbc64 100644 --- a/app/delivery/send_to_providers.py +++ b/app/delivery/send_to_providers.py @@ -86,6 +86,7 @@ def send_sms_to_provider(notification): notification.job_id, notification.job_row_number, ) + print(hilite(f"recipient: {recipient}")) except Exception: # It is our 2facode, maybe key = f"2facode-{notification.id}".replace(" ", "") @@ -108,6 +109,7 @@ def send_sms_to_provider(notification): "sender": notification.reply_to_text, "international": notification.international, } + print(hilite(f"send_sms_kwargs: {send_sms_kwargs}")) db.session.close() # no commit needed as no changes to objects have been made above message_id = provider.send_sms(**send_sms_kwargs) diff --git a/app/job/rest.py b/app/job/rest.py index 85414a29c..eea270e27 100644 --- a/app/job/rest.py +++ b/app/job/rest.py @@ -33,7 +33,7 @@ notifications_filter_schema, unarchived_template_schema, ) -from app.utils import midnight_n_days_ago, pagination_links +from app.utils import hilite, midnight_n_days_ago, pagination_links job_blueprint = Blueprint("job", __name__, url_prefix="/service//job") @@ -172,6 +172,7 @@ def create_job(service_id): raise InvalidRequest("Create job is not allowed: service is inactive ", 403) data = request.get_json() + print(hilite(f"data at the top of create_job: {data}")) original_file_name = data.get("original_file_name") data.update({"service": service_id}) try: