Commit Graph

7699 Commits

Author SHA1 Message Date
Toby Lorne
59bce8e52f Merge pull request #3012 from alphagov/no-more-stub-cbc
Remove references to stub CBC
2020-10-26 12:35:19 +00:00
Toby Lorne
fdacb2e0d7 broadcasts: remove references to cbc stub
We are phasing out our cbc-proxy stub which displayed CAP XML messages

We are in the process of testing with real CBCs, so maintaining our own
stub is not useful

This commit
* removes the HTTP POST requests to the CBC proxy
* writes up the update/cancel methods of the cbc_client (not impl)

Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
2020-10-26 10:23:49 +00:00
Toby Lorne
1aba4925e5 Merge pull request #3011 from alphagov/send-polygons-to-cbc-proxy
clients: cbc_proxy actions accepts areas param
2020-10-26 10:22:48 +00:00
Leo Hemsted
ed182c2a22 return just the columns we need for collating letters
previously we were returning the entire ORM object. Returning columns
has a couple of benefits:

* Means we can join on to services there and then, avoiding second
  queries to get the crown status of the service later in the collate
  flow.
* Massively reduces the amount of data we return - particularly free
  text fields like personalisation that could be potentially quite big.
  5 columns rather than 26 columns.
* Minor thing, but will skip some CPU cycles as sqlalchemy will no
  longer construct an ORM object and try and keep track of changes. We
  know this function doesn't change any of the values to persist them
  back, so this is an unnecessary step from sqlalchemy.

Disadvantages are:

* The dao_get_letters_to_be_printed return interface is now much more
  tightly coupled to the get_key_and_size_of_letters_to_be_sent_to_print
  function that calls it.
2020-10-23 20:01:18 +01:00
Toby Lorne
aa002afd31 clients: cbc_proxy actions accepts areas param
related:
https://github.com/alphagov/notifications-broadcasts-infra/pull/23

Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
2020-10-23 17:09:00 +01:00
Leo Hemsted
d9ceed55b5 Merge pull request #3009 from alphagov/limit-collate-task-to-50k-letters
limit collate task to 50,000 messages
2020-10-23 15:41:45 +01:00
Leo Hemsted
f8fbaba77d limit collate task to 50,000 messages
we've seen issues where tasks mysteriously hang and do not process
large volumes of letters - in this case >150k letters in created state.

to try and get at least some letters out of the door, limit the query to
only return 50k letters per postage type. We may need to run the task
multiple times, or letters may get delayed until the next day when
they'd be picked up (provided there's enough capacity then). The task
should only be re-run AFTER the ftp tasks have all finished, and updated
the letters to sending, or we run the risk of sending the same letters
twice.

For context, the largest ever letter day we've sent is ~65k in march of
this year.
2020-10-23 15:28:34 +01:00
Chris Hill-Scott
55efbb0bb1 Merge pull request #3010 from alphagov/revert-3001-remove-upload-letters-permission
Revert "Remove the upload letters permission"
2020-10-23 15:26:19 +01:00
Chris Hill-Scott
88cd92b946 Revert "Remove the upload letters permission" 2020-10-23 15:14:37 +01:00
Chris Hill-Scott
e7c1f7c60e Merge pull request #3001 from alphagov/remove-upload-letters-permission
Remove the upload letters permission
2020-10-23 14:27:48 +01:00
Leo Hemsted
96f59a51e3 Merge pull request #3008 from alphagov/stream-dvla-files
stream notifications when collating zip files
2020-10-23 12:31:04 +01:00
Leo Hemsted
4b61060d32 stream notifications when collating zip files
we had issues where we had 150k 2nd class notifications, and the collate
task never ran properly, presumably because the volume of data being
returned was too big.

to try and help with this, we can switch to streaming rather than using
`.all` and building up lists of data. This should help, though the
initial query may be a problem still.
2020-10-23 12:20:26 +01:00
David McDonald
6fbf12afeb Merge pull request #3007 from alphagov/simplify-filename
Remove 'INSOLVENCY' from zip files for insolvency letters
2020-10-23 10:21:10 +01:00
David McDonald
3dcb97c45a Remove 'INSOLVENCY' from zip files for insolvency letters
This is at request of DVLA. They would prefer to have zip files with the
same number of arguments in the name. After being offered a few
different options, such as including an org and service id for all zips,
they chose to just remove the 'INSOLVENCY' tag.

For more context see PR that added the tag
https://github.com/alphagov/notifications-api/pull/3006
2020-10-23 09:58:28 +01:00
David McDonald
890a66de46 Merge pull request #3003 from alphagov/staging-preview-cbc
Non-production environments invoke CBC Proxy during broadcast event creation
2020-10-22 16:21:11 +01:00
Toby Lorne
ff1ffc7fba clients: cbc_proxy lambda client is unabbreviated
for code clarity

Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
2020-10-22 12:22:11 +01:00
Toby Lorne
c9eb9c8622 clients: cbc_proxy client tests remove unused stmt
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
2020-10-22 12:20:31 +01:00
Toby Lorne
adc2ce8283 clients: cbc_proxy has clarifying comments
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
2020-10-22 12:19:25 +01:00
Toby Lorne
1badf93f0a config: correctly get cbc_proxy_client env vars
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
2020-10-22 12:11:22 +01:00
Leo Hemsted
897b7a9188 Merge pull request #3006 from alphagov/turn-insolvency-back
Start sending letters from Insolvency Service to DVLA again
2020-10-22 10:15:26 +01:00
Pea Tyczynska
deb360846d Mark letters from insolvency service
So that DVLA knows to process them separately to avoid issues.
2020-10-21 16:56:18 +01:00
Pea Tyczynska
9ac65ee95c Start sending letters from insolvency service again 2020-10-21 16:56:18 +01:00
Pea M. Tyczynska
c149f5020f Merge pull request #3004 from alphagov/divide-letters-by-service
Divide letters by service when putting in ZIP files
2020-10-21 15:31:26 +01:00
Pea Tyczynska
d745ba310e Divide letters by service when putting in ZIPs
When letters are sent to DVLA, we will now put them in a separate
ZIP file for each service, so that if there are printing issues
due to bad files from one service, other services will hopefully
not be affected by that.
2020-10-21 15:19:06 +01:00
Toby Lorne
a3293d3c8c manifest: add cbc proxy env vars
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
Co-authored-by: Katie <katie.smith@digital.cabinet-office.gov.uk>
2020-10-20 16:59:50 +01:00
Toby Lorne
62951fa039 clients: cbc_proxy tests for handling lambda response
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
2020-10-20 15:26:27 +01:00
Toby Lorne
75de4abd47 clients: cbc_proxy handles lambda invoke response
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
2020-10-20 15:18:11 +01:00
Toby Lorne
73507b3abc clients: cbc_proxy invokes hardcoded function
right now we are doing an end-to-end journey with a CBC from Notify (the
CBE) and we would like to approve a broadcast in notify and have it
appear on our test handset

in order to do this, we:
* hook up the lambda that we made in the correct VPC to cbc_proxy client
* test that it is called correctly

Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
Co-authored-by: Pea <pea.tyczynska@digital.cabinet-office.gov.uk>
Co-authored-by: Katie <katie.smith@digital.cabinet-office.gov.uk>
2020-10-20 14:00:53 +01:00
Toby Lorne
ee79768d43 clients: cbc_proxy client uses _ld not _lambda
_ld is better than _lambda because it causes primitive python syntax
highlighting to not get confused

_lambda is better than _ld because it is less jargon

Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
Co-authored-by: Pea <pea.tyczynska@digital.cabinet-office.gov.uk>
Co-authored-by: Katie <katie.smith@digital.cabinet-office.gov.uk>
2020-10-20 13:59:52 +01:00
Toby Lorne
14f8e7a5ff clients: cbc_proxy client inits lambda client
Using correct:
* key id
* secret key
* region

Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
Co-authored-by: Pea <pea.tyczynska@digital.cabinet-office.gov.uk>
Co-authored-by: Katie <katie.smith@digital.cabinet-office.gov.uk>
2020-10-20 13:33:51 +01:00
Toby Lorne
efa6fb0bd9 clients: explicitly declare cbc_proxy_client
it is global rather than local but python cannot infer this and we get
UnboundLocalError

Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
2020-10-20 13:01:17 +01:00
Toby Lorne
2cc0a65851 celery: broadcast msg create invokes cbc proxy
When we create a broadcast message, we should invoke the cbc proxy to
send a cap message

Either a function will be invoked within AWS, or a noop function call
is made, depending on the environment

We have only implemented CB message creation in the CBC Proxy, without
polygons, therefore we:
* only invoke the CBC Proxy during message creation
* only send description, identifier, and hard-coded headline

Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
Co-authored-by: Pea <pea.tyczynska@digital.cabinet-office.gov.uk>
Co-authored-by: Katie <katie.smith@digital.cabinet-office.gov.uk>
2020-10-20 11:57:26 +01:00
Chris Hill-Scott
182bfa7e10 Remove the upload letters permission
As of https://github.com/alphagov/notifications-admin/pull/3690 it’s no
longer referred to.
2020-10-20 11:46:11 +01:00
Toby Lorne
33ea75930a clients: add cbc proxy clients
We are going to invoke a lambda to send a message to the CBC

We need a CBC Proxy Client to do this

The Client will be able to send/update/cancel broadcasts in the CBC

Unless we have configured the app with AWS credentials for the
CBCProxyClient, we just want to use a client that does nothing: the noop
client

The AWS access keys are separate for the CBC Proxy vs other Notify AWS
things because the CBC Proxy lives in another AWS account

Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
Co-authored-by: Pea <pea.tyczynska@digital.cabinet-office.gov.uk>
Co-authored-by: Katie <katie.smith@digital.cabinet-office.gov.uk>
2020-10-20 11:23:16 +01:00
Pea M. Tyczynska
05160bc064 Merge pull request #2999 from alphagov/temporary-measure-letters
Temporarily do not send letters from Insolvency Service to DVLA
2020-10-16 16:24:34 +01:00
Pea Tyczynska
30bd311eb1 Temporarily do not send letters from Insolvency Service
to DVLA. This is a temporary measure over the weekend so that
DVLA can catch up with all other letters.

We should revert this on Monday 19.10.2020
2020-10-16 16:13:32 +01:00
Chris Hill-Scott
8b123fd6a4 Merge pull request #2996 from alphagov/serialise-broadcast-template-content
Serialise content for broadcast templates
2020-10-15 16:35:10 +01:00
Rebecca Law
9eb00bbb55 Merge pull request #2998 from alphagov/sort-zip-files
Adding service_id to the sort order for the letters being sent to print.
2020-10-15 13:19:08 +01:00
Rebecca Law
b2ff4277c9 Adding service_id to the sort order for the letters being sent to print.
We have had a few instances where letters have caused problems. Particularly for precompiled letters, often the issue comes from the same service.
The hope is that by adding a sort order this will help the print provider narrow down the problem.

There is a small degradation of the performance of the query, but it's not enough to concern me.
2020-10-15 09:39:07 +01:00
Chris Hill-Scott
3a2081dc06 Serialise content for broadcast templates
Broadcast services only have broadcast templates. But on the frontend
we show the template type under the name of the template. This is
redundant. It would be better to preview the content of the template
instead.

At the moment we can’t do this because we optimised the template schema
response to not include the content of the templates in
https://github.com/alphagov/notifications-api/pull/2880

This commit reverses that optimisation, for broadcast templates only,
and expands the tests to cover all template types.
2020-10-13 16:27:29 +01:00
Pea M. Tyczynska
50982ff36a Merge pull request #2991 from alphagov/reset-password-email-gets-forward-link
Put redirect link in reset password email link
2020-10-12 12:26:42 +01:00
Pea Tyczynska
51811de919 Improve variable names for readability
Also next_redirect parameter in _create_reset_password_url does
not have to be a default arg, so I removed that following review.
2020-10-09 17:47:26 +01:00
Chris Hill-Scott
e5413cd193 Merge pull request #2990 from alphagov/serialise-broadcast-content
Serialise content in broadcast message response
2020-10-08 11:56:51 +01:00
Chris Hill-Scott
57473ef65d Rename template_content to content
`template_content` is a template that hasn't had its placeholders filled
in whereas content is where it would have (which is what has happened
above)
2020-10-08 11:39:17 +01:00
Chris Hill-Scott
80352bafe1 Update test to check personalisation
While the API still has a column and field for personalisation I think
it makes sense for it to consider the personalisation when serialising
the broadcast, so we should have a test for this.

This way the API still works as a coherent whole, and the admin app just
happens to be a client of the API which doesn’t implement the
personalisation feature.

If we want to remove personalisation from the API at another time we
should do it wholesale.
2020-10-07 10:52:31 +01:00
Rebecca Law
690cf72175 Merge pull request #2989 from alphagov/change-config-for-scheduled-jobs
On the crazy weekend we checked for scheduled jobs every minute.
2020-10-06 13:15:21 +01:00
Pea Tyczynska
e91deff448 Put redirect link in reset password email link
This is so when users reset their password they are still
redirected to pages they were meant to visit.

This change was done specifically so everyone who is meant to see
broadcast tour sees it, but it will improve lives of all users
who wanted to visit a page on Notify but then had to reset
their password in the process
2020-10-05 16:58:10 +01:00
Chris Hill-Scott
7da0d46767 Serialise content in broadcast message response
This will let us show the content of the broadcast message in places we
can’t at the moment.
2020-10-02 16:39:24 +01:00
David McDonald
cfe32cf459 Merge pull request #2975 from alphagov/rename-redis-template-keys
Step 2 of renaming cache keys for templates
2020-10-02 14:26:03 +01:00
Chris Hill-Scott
f2314333b5 Merge pull request #2982 from alphagov/improve-efficiency-of-process-missing-rows
Improve efficiency of process missing rows task
2020-10-02 11:23:35 +01:00