Commit Graph

2360 Commits

Author SHA1 Message Date
Martyn Inglis
d6fc2335e6 Latest utils 2017-04-13 12:52:56 +01:00
Martyn Inglis
1894c96f3a updated test to use random string not numeric id formats 2017-04-13 12:52:49 +01:00
Martyn Inglis
b8cfaf02f6 Ordered the query - ambiguous orders made tests flaky 2017-04-13 12:52:30 +01:00
Martyn Inglis
b0e5062df2 Added the random string reference to the letter
- uses the reference field on the notifications table to store a 16char random string used to cross reference DVLA letters back to the notification
- used as letter barcode does not have space for a UUID notification id

Depends on https://github.com/alphagov/notifications-utils/pull/149

Renamed the numeric_id to notification_reference in utils and changed validation rules to match this

Note also the persist_notification method set "reference" to be "client_reference" which is confusing and they are different things, so fixed this too.
2017-04-12 17:56:55 +01:00
Leo Hemsted
b55b1007d0 Merge pull request #897 from alphagov/fix-slow-delete
remove slow join from template-last-use query
2017-04-11 16:03:21 +01:00
Rebecca Law
1e510487e2 Merge pull request #894 from alphagov/refactor-s3-upload
Refactor s3 upload
2017-04-11 11:32:12 +01:00
Rebecca Law
e022fe0403 Update build_dvla_file with a mocked notify_celery.send_task.
Check the task is being called with the right parameters.
2017-04-11 11:13:47 +01:00
Leo Hemsted
c7c47a029f remove slow join from template-last-use query 2017-04-10 17:33:31 +01:00
Rebecca Law
6949779544 Refactor s3upload
s3upload function has been moved to notifications-utils.
https://github.com/alphagov/notifications-utils/pull/138 must be merge first.

Remove scratch code that I was using to test celery.send_task method

Revert the update to default_retry_delay.
Increase the countdown, wait 1 minute before executing the task.

Some of the changes in my previous commit are included here, that branch will be merged before this one, so it will make sense.

Update version of notification_utils

Update the version of notifications-utils
2017-04-10 17:17:58 +01:00
Rebecca Law
65a91c440b Refactor s3upload
s3upload function has been moved to notifications-utils.
https://github.com/alphagov/notifications-utils/pull/138 must be merge first.
2017-04-10 17:12:56 +01:00
Rebecca Law
f8618f8989 Merge pull request #896 from alphagov/task-to-update-letter-job
Update the update statements with the updated_at and sent_at timestamps.
2017-04-07 15:37:20 +01:00
Rebecca Law
7ba9b1d261 Update the update statements with the updated_at and sent_at timestamps. 2017-04-07 15:21:27 +01:00
Rebecca Law
3e216fe83b Merge pull request #895 from alphagov/task-to-update-letter-job
Task to update letter job
2017-04-07 14:49:07 +01:00
Rebecca Law
2d9a449d1e Changed styling 2017-04-07 14:36:00 +01:00
Rebecca Law
5a810a47ac Fix type with status 2017-04-07 13:38:30 +01:00
Rebecca Law
22fc9e3c81 Fix dependency issue. When you import schemas in a test you need to do it locally in the method.
I've just taked it out all together.
2017-04-07 12:29:53 +01:00
Rebecca Law
f7ab49246a Added an endpoint that returns all letter jobs, ordered by created_at desc. 2017-04-07 11:50:56 +01:00
Rebecca Law
61d228e797 Remove test filter 2017-04-07 11:22:03 +01:00
Rebecca Law
50a5bedcbf Refactor update to notifcations to be a bulk update. This is much better for performance. 2017-04-07 10:59:12 +01:00
Rebecca Law
cf3eeb2120 Merge branch 'master' into task-to-update-letter-job
Conflicts:
	tests/app/celery/test_tasks.py
2017-04-06 17:18:09 +01:00
Rebecca Law
add0cfa62f Add a task for the FTP app to call that will update the job to sent to dvla and all the notifications for that job as sending. 2017-04-06 17:16:08 +01:00
Chris Hill-Scott
8bd386028b Merge pull request #893 from alphagov/dont-output-to_name_2
Build DVLA file with blank `TO_NAME_2` field
2017-04-06 16:54:02 +01:00
Rebecca Law
895b5d13dd Merge pull request #891 from alphagov/api-to-start-dvla-file-sending
Api to start dvla file sending
2017-04-06 15:35:15 +01:00
Rebecca Law
a9e429b09f Fix task name, should have dashes not underscores 2017-04-06 15:26:50 +01:00
Rebecca Law
1d46dd0be1 Remove bucket-name from the task. 2017-04-06 15:03:06 +01:00
Rebecca Law
b6abb82212 Merge pull request #887 from alphagov/update-job-status
Update job status for letter jobs.
2017-04-06 14:22:09 +01:00
Rebecca Law
24c871179d Merge pull request #885 from alphagov/platform-admin-query
Platform admin query
2017-04-06 13:58:34 +01:00
Chris Hill-Scott
7a6d748c6a Build DVLA file with blank TO_NAME_2 field
Problem: we were sending the first line of the address in the
`TO_NAME_2` field. This meant that they couldn’t do any PAF lookups with
it, because it wasn’t where they were expecting.

The first line of the address is the second line of what our users give
us. We need to give this to DVLA as the _third_ line of the address
output, which they call `TO_ADDRESS_LINE_1`.
2017-04-06 13:12:05 +01:00
Rebecca Law
7bd0a07f0d Added bucket name to task arguments. 2017-04-06 12:18:34 +01:00
Rebecca Law
970a4e7b4e New endpoint to send a list of job ids to a queue.
The task will be picked up by the FTP app. Given the list of job ids the tasks will get all the files from s3, aggregate them then send to dvla
2017-04-06 12:14:17 +01:00
Rebecca Law
9e175f42e8 Refactor to make code more readible. 2017-04-06 11:18:21 +01:00
Rebecca Law
4f6a66c904 Merge branch 'master' into update-job-status
Conflicts:
	app/dao/jobs_dao.py
	tests/app/dao/test_jobs_dao.py
2017-04-06 11:11:37 +01:00
minglis
29c84d73ff Merge pull request #889 from alphagov/restrict-delete-files-job-query
Updates to the delete CSV file job to reduce the number jobs included in any run.
2017-04-06 10:09:49 +01:00
minglis
4d5e697f1c Merge pull request #888 from alphagov/throw-exception-on-long-running-client-call
Throw exception on long running client call
2017-04-06 09:24:26 +01:00
Martyn Inglis
80965e4651 Good spot by Leo on has_calls not being exclusive,
Using call_args_list to get accurate list of args
2017-04-05 16:50:32 +01:00
Martyn Inglis
bce75ae0db Bump timeout on research mode to match normal behaviour 2017-04-05 16:39:46 +01:00
Martyn Inglis
c8a26fcd40 Fixed test names 2017-04-05 16:30:53 +01:00
Martyn Inglis
832005efef Updates to the delete CSV file job to reduce the number of eligible jobs in any run
- previously this was unbounded, so it got all jobs older then 7 days. In excess of 75,000 🔥
- this meant that the job took (a) a long time and (b) a lot memory and (c) doing the same thing every day

These changes mean that the job has a 2 day eligible window for jobs, minimising the number of eligible jobs in a run, whilst still retaining some leeway in event if it failing one night.

In principle the job runs early morning on a given day. The previous 7 days are left along, and then the previous 2 days worth of files are deleted:

so:
runs on
31st
30,29,28,27,26,25,24 are ignored
23,22 jobs here have files deleted
21 and earlier are ignored.
2017-04-05 16:23:41 +01:00
Rebecca Law
6313640cbf Refactor if statement 2017-04-05 16:00:39 +01:00
Martyn Inglis
43a31fa497 Removed a stray sleep used for testing. 2017-04-05 15:33:02 +01:00
Martyn Inglis
72ecca4dab Added a 60 second timeout to the MMG and fire text clients.
- This is a CONNECT and a READ timeout.
- Gets wrapped in the standard client exception, with a status code of 504, message Gateway timeout.
- Is quiet noisy in logs to allow us to see it
- Ensures we flick across the provider.

To test change the timeout to 0 and it will timeout.
2017-04-05 15:31:37 +01:00
Chris Hill-Scott
61a8097ca5 Merge pull request #886 from alphagov/revert-883-revert-867-bump-utils-lists-as-placeholder-values
Revert "Revert "Bump utils to allow lists as placeholder values""
2017-04-05 13:14:57 +01:00
Chris Hill-Scott
f98f220e74 Update utils to fix letter output
Includes:
- [x] https://github.com/alphagov/notifications-utils/pull/136
- [ ] https://github.com/alphagov/notifications-utils/pull/131
2017-04-05 12:35:28 +01:00
Rebecca Law
c49217b1bf Update job status to ready to send, indicating the file for the job has been uploaded to S3. 2017-04-05 11:57:56 +01:00
Chris Hill-Scott
3783a449b7 Merge pull request #880 from alphagov/pass-contact-block
Pass through contact block from service to outputted letter
2017-04-05 09:45:28 +01:00
Chris Hill-Scott
1802c84b8a Add handling for data types other than list/string
Brings in:
- [ ] https://github.com/alphagov/notifications-utils/pull/135

Also adds extra tests for:
- the exact issue that we saw in production when #867 was deployed
- what happens when `None` is passed as a placeholder value, because
  this should never get as far as the relevant bit of utils
2017-04-05 09:28:17 +01:00
Chris Hill-Scott
7943b6819b Revert "Revert "Bump utils to allow lists as placeholder values"" 2017-04-05 09:18:58 +01:00
Rebecca Law
0506bc3b0c Updated the fetch_stats_by_date_range to return test notifications if the start and end date are with in the last 7 days.
If the date range is with the last 7 days we query Notifcations.
If the date range is outside of the last 7 days we query NotificationHistory.
NotificationHistory does not persist notifications created with a test api key.
2017-04-04 16:34:20 +01:00
Leo Hemsted
0c4d44015a Merge pull request #883 from alphagov/revert-867-bump-utils-lists-as-placeholder-values
Revert "Bump utils to allow lists as placeholder values"
2017-04-04 16:06:35 +01:00
Martyn Inglis
57bd6494e1 WIP - adding request timeout 2017-04-04 16:05:25 +01:00