Commit Graph

6987 Commits

Author SHA1 Message Date
Rebecca Law
8990b70eaa Merge pull request #2439 from alphagov/fix-boolean-columns
Fix boolean columns for organisation migration
2019-04-05 13:57:25 +01:00
Rebecca Law
38b8a00344 Fix boolean columns 2019-04-05 12:09:57 +01:00
Toby Lorne
0022923bd0 Add Cronitor decorator collate-letter-pdfs-for-day
This celery task was not decorated with the cronitor decorator so never
checked in with cronitor.

Adding the decorator will ensure this task is monitored.

The requisite cronitor key is in the credentials repository already.

Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
2019-04-05 10:26:18 +01:00
Katie Smith
46c2f6a4ac Merge pull request #2436 from alphagov/command-to-get-zips-sent-details
Add command to get notification details from 'zips sent' files
2019-04-05 10:24:19 +01:00
Katie Smith
1f1c94be9d Add command to get notification details from 'zips sent' files
Added a command to get more detailed information about the letters that
are listed in the files of zip files sent that are stored on S3. This takes
one or more file paths as arguments and creates a CSV file with a row for each
letter.
2019-04-04 16:21:58 +01:00
Rebecca Law
7feb2f128d Merge pull request #2435 from alphagov/populate-org-data-from-file
Populate org data from file
2019-04-04 16:20:12 +01:00
Rebecca Law
2b36678a26 Populate data from file for organisation data
Finished the command to populate organistions and domains from a spreadsheet.
Should be a one time use thing.

fix codestyle
2019-04-04 16:04:18 +01:00
Chris Hill-Scott
f62ed714f8 Add a method to guess organisation from a domain
We need this in the admin app while we still have pages that:
- talk about the data sharing and financial agreement
- but aren’t within a service (so can’t look at the service’s
  organisation)

This is a get, but it deliberately won’t work if you pass it an email
address, in order not to put personally identifying information in our
logs.
2019-04-04 10:13:19 +01:00
Leo Hemsted
c654bc1e5e Merge pull request #2433 from alphagov/billing-fix
fix create_nightly_billing date bug
2019-04-03 15:59:54 +01:00
Leo Hemsted
1c6b291a42 we cant reason about the order of sets when iterated
split out assert into three parts
2019-04-03 15:47:53 +01:00
Leo Hemsted
28bff28786 remove letter rates between tests
we only use them in ft_billing so no reason not to delete them. makes
the tests read better as it's obvious how they work too.
2019-04-03 15:34:02 +01:00
Leo Hemsted
9f1f858997 update fact_billing_dao::get_rate to use dates not datetimes
update unit tests too
2019-04-03 14:52:41 +01:00
Leo Hemsted
6f41f6c7d7 use db models instead of tuples when referring to rate objects
makes it less confusing
2019-04-03 13:08:53 +01:00
Rebecca Law
b17cfd50b7 Merge pull request #2431 from alphagov/change-file-format-for-ack-files
Update alert for new DVLA file format
2019-04-03 12:09:59 +01:00
Rebecca Law
dc8159104e Update letter_raise_alert_if_no_ack_file_for_zip for new DVLA file format
When we send a zip file of letters to DVLA we expect them to send back an acknowledgement of those files.
Previously they named the files like NOTIFY.20180202091254.ACK.TXT and the contents would contain the name of the zip file we sent with a date of when they got it.
They have updated this format to mirror the format of the zip file because there was an instance where they sent 2 files of the same name so the later overwrote the first.
Since the name matches our name, there is no need to get the file from S3 but just compare file names.
2019-04-03 11:03:42 +01:00
Leo Hemsted
fcc25abf18 Merge pull request #2430 from alphagov/nightly-fix
fix nightly ft stats tables task to respect BST
2019-04-02 15:49:43 +01:00
Leo Hemsted
1dc084be54 fix nightly ft stats tables task to respect BST
the create_nightly_notification_status task runs at 00:30am UK time,
however this means that in summer datetime.today() will return the
wrong date as the server (which runs on UTC) will run the task at
23:30 (populating the wrong row in the table).

fix this to use nice tz aware functions
2019-04-02 15:15:07 +01:00
Rebecca Law
8cb0d30cec Merge pull request #2429 from alphagov/perf-platform-date
Fix performance platform date bug
2019-04-02 12:50:25 +01:00
Leo Hemsted
f1b3ae553f add tests for get_london_midnight_in_utc with a date object
we sometimes call it with a timestamp, but sometimes with just a date
object. It works with both, lets add the tests to prove that
2019-04-02 11:52:37 +01:00
Leo Hemsted
3739d9055d clean up usage of dates/datetimes in performance platform tasks
* call variables unambiguous things like `start_time` or `bst_date` to
  reduce risk of passing in the wrong thing
* simplify the count_dict object - remove nested dict and start_date
  fields as superfluous
* use static datetime objects in tests rather than calculating them
  each time
2019-04-02 11:49:20 +01:00
Toby Lorne
4abbb7137a Fix sending of performance platform
The pp client converts to UTC using the convert_utc_to_bst notify util.

This requires a datatime not a date, pass it a datetime, and add an
assertion in an existing test.

I didn't want to use the midnight conversion util in the test.

Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
2019-04-02 09:06:39 +01:00
Leo Hemsted
1250e47cc7 Merge pull request #2425 from alphagov/remove-inbound-get
remove get for inbound sms by phone number
2019-04-01 16:43:06 +01:00
Rebecca Law
020eb76f73 Merge pull request #2427 from alphagov/fix-date-bug-for-performance-platform
Fix date bug for performance platform
2019-04-01 12:16:31 +01:00
Rebecca Law
fb398876ee Merge branch 'master' into fix-date-bug-for-performance-platform 2019-04-01 12:05:48 +01:00
Rebecca Law
1456aa7789 Fix for performance platform updates.
Changed the query to get the performance platform stats from ft_notification_status. But the date used for the query needed to be a date, not datetime so the equality worked.
2019-04-01 12:03:57 +01:00
Rebecca Law
814d9bee99 Merge pull request #2426 from alphagov/fix-platfom-admin-bug
Fix BST date bug for platform admin summary page.
2019-04-01 11:58:36 +01:00
Rebecca Law
a47ecf0711 Fix test where the year was static
Remove print
2019-04-01 11:43:02 +01:00
Rebecca Law
d83ee6171e Fix codestyle 2019-04-01 11:02:02 +01:00
Rebecca Law
b9b81bca8f Fix BST date bug for platform admin summary page.
Added test for that.
2019-04-01 10:56:55 +01:00
Rebecca Law
0561fe5e11 Merge pull request #2424 from alphagov/use-ft_notification_status-for-perf-platform-updates
Use ft_notification_status instead of notification_history
2019-03-29 16:08:14 +00:00
Rebecca Law
fe30d2879a Fix test 2019-03-29 15:46:36 +00:00
Rebecca Law
e9607f227d Remove query that's no longer needed. 2019-03-29 15:38:48 +00:00
Leo Hemsted
68aaf1e877 remove get for inbound sms by phone number
query args from GET requests are put into our logs, and we should avoid
personal data (eg phone numbers) in them. Remove this old GET now that
it's not used by the admin app anymore
2019-03-29 15:30:07 +00:00
Rebecca Law
1806f092f3 Update the nightly task that send performance platform statistics to use ft_notification_status rather than notification_history.
The previous query was including all notifications regardless of notification_status. I don't think that's right, it shouldn't include things like technical-failure or validation-failed. Thoughts?

I also need to remove the query that's no longer being used.
2019-03-29 14:21:05 +00:00
Alexey Bezhan
4254721cc4 Merge pull request #2422 from alphagov/increase-db-conn-pool-size
Increase DB connection pool size for API instances
2019-03-29 10:06:15 +00:00
Leo Hemsted
29df5730cb Merge pull request #2423 from alphagov/more-retention
combine post + get inbound, and make them respect data retention
2019-03-28 15:58:12 +00:00
Leo Hemsted
ff328eb594 add test for different retention lengths 2019-03-28 15:55:07 +00:00
Leo Hemsted
cf248a2af3 combine post + get inbound, and make them respect data retention
also removed the limit/limit_days args as they're not used by admin
2019-03-28 15:38:26 +00:00
Alexey Bezhan
1425d6e225 Increase DB connection pool size for API instances
We've seen the SQLAlchemy "could not acquire connection" error in
production during heavy traffic. Since we have more gunicorn eventlet
workers than we have DB connections available some workers need to
wait for a DB connection to become available before they can proceed
with the request. There's a timeout set on how long a worker would
wait and if that timeout is exceeded the above exception is raised.

Currently, we're using at most 1000 out of 5000 max DB connections,
40% peak CPU usage on the DB instance and an average of 60% CPU on
API instances during heavy load. The number of DB connections is
proportionally similar in preview and staging.

This slightly increases the number of max DB connections per API
instance. This should improve our utilization of API instances by
increasing the number of workers that can communicate with the DB
concurrently while staying well within the max DB connections limit.
2019-03-28 15:02:37 +00:00
Leo Hemsted
329fa9ba0d Merge pull request #2421 from alphagov/inbound-retention
make inbound sms page respect data retention
2019-03-28 14:28:54 +00:00
Leo Hemsted
493da7ef88 add test for inbound sms older than a week 2019-03-28 14:00:10 +00:00
Leo Hemsted
97110e293b make inbound sms page respect data retention
also, it should default to last 7 days, not last 6 days. also change
count_inbound_sms to have the days passed in, so that it's more
explicit at the endpoint that we only return 7 days regardless of your
service's data retention
2019-03-27 17:47:26 +00:00
Rebecca Law
b764eae738 Merge pull request #2420 from alphagov/change-pyup-to-create-weekly-updates
Add pyup configuration so that we only get one PR per week.
2019-03-27 15:26:47 +00:00
Rebecca Law
818ffe11b9 Merge pull request #2419 from alphagov/split-task
Split task for updating letters
2019-03-27 15:26:34 +00:00
Rebecca Law
b75b3e21f9 Add pyup configuration so that we only get one PR per week. 2019-03-27 14:58:13 +00:00
Rebecca Law
cb94f949a1 New command to iterate through the files on S3 and call record_daily_sorted_counts.
There are many files from early on that have not had the sorted counts recorded.
2019-03-26 15:49:21 +00:00
Chris Hill-Scott
a469bfd892 Merge pull request #2418 from alphagov/retry-migration-283
Retry making services created by platform admin users not counted in the list of live services
2019-03-26 13:32:25 +00:00
Chris Hill-Scott
6c20e510e8 Merge pull request #2416 from alphagov/pyup-update-pytest-mock-1.10.1-to-1.10.2
Update pytest-mock to 1.10.2
2019-03-26 09:37:37 +00:00
Chris Hill-Scott
b26c835818 Merge pull request #2406 from alphagov/pyup-update-coveralls-1.6.0-to-1.7.0
Update coveralls to 1.7.0
2019-03-26 09:37:30 +00:00
Chris Hill-Scott
853314efe9 Retry making services created by platform admin users not counted in the list of live services
The previous migration didn’t work because the `created_by_id` column
in services references the user who created the _version_ of the
service, not who created the service originally.

This commit runs another migration to wipe all the data, and replace it
using an operation that looks at the first version of the service in the
history table, which will reference the user who actually created the
service.
2019-03-25 17:31:52 +00:00