Commit Graph

2325 Commits

Author SHA1 Message Date
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
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
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
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
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
Chris Hill-Scott
cb208473c6 Revert "Bump utils to allow lists as placeholder values" 2017-04-04 15:19:53 +01:00
minglis
734772c1eb Merge pull request #882 from alphagov/update-scheduled-jobs
Update scheduled jobs
2017-04-04 15:12:13 +01:00
Martyn Inglis
b08ac6eb63 Ensure priority queue read by development machines. It's now a default queue in the config. 2017-04-04 13:53:01 +01:00
Martyn Inglis
ac445114c7 When using a priority template put the notification in the priority queue.
- there is now a dedicated worker to handle priority queues. We don't now bundle this in the default worker.
2017-04-04 13:44:11 +01:00
Martyn Inglis
43bf973b1d A few changes to the celery workers
1) Beat worker now a single instance with 128M memory
2) New worker for periodic tasks. Single worker, 2G ram
3) new worker for priority queues. Standard instance and memory settings.
2017-04-04 13:43:28 +01:00
Martyn Inglis
ce09765dad Turned down the Memory usage on prod. This was bumped to 2G to try and offset memory usage which caused the delivery worker to die.
We are now spinning this periodic worker off into it's own worker, so it's not bundled with the app. this means we can set it's memory usage specifically so we don't need to bump all the workers.
2017-04-04 13:42:21 +01:00
Martyn Inglis
787d0da7db Broke the periodic queue out from the standard worker.
- now has own worker with worker count of 2
- this is too ensure that any issues with scheduled jobs do not affect core applications
2017-04-04 11:23:54 +01:00
Chris Hill-Scott
0ac3bfcb81 Merge pull request #867 from alphagov/bump-utils-lists-as-placeholder-values
Bump utils to allow lists as placeholder values
2017-04-03 17:31:30 +01:00
Chris Hill-Scott
b19486ec99 Include fixes for heading spacing
Brings in
- [x] https://github.com/alphagov/notifications-utils/pull/134
2017-04-03 17:22:34 +01:00
Rebecca Law
ef6b6040d3 Merge pull request #881 from alphagov/fix-timezone
Add fix for bst
2017-04-03 16:46:55 +01:00
Ken Tsang
eef8aceac5 Refactored get utc in bst to use localize 2017-04-03 16:20:54 +01:00
Ken Tsang
817790784f Fix test for utc to bst conversion 2017-04-03 16:02:26 +01:00
Ken Tsang
2b53e14a73 Add fix for bst 2017-04-03 15:49:23 +01:00
Chris Hill-Scott
e47a008dd9 Pass through contact block from service to letter
Whatever a user has entered for their service’s contact block should
appear in the right place in the file we give to DVLA.

The work to output in the right fields in the DVLA file has already been
done. We just weren’t passing it through. This commit passes it through.
2017-04-03 13:27:47 +01:00
Chris Hill-Scott
eb5f9421dd Check for what DVLALetterTemplate is called with
Extends the test to make sure that the thing that builds each line of
the file is getting called with the right template, personalisation and
numeric ID. Will be helpful the more complicated the call to the
template gets.
2017-04-03 13:25:22 +01:00
Chris Hill-Scott
c4c3268dd9 Use a simpler method of generating random number
Rather than generating each digit of the number, generate the whole
random number in one go. Should be faster, and is a bit easier to read.

Don’t need to worry about it not being zero-padded because the
`Template` class handles this here:
6ddd2ff352/notifications_utils/template.py (L410)
2017-04-03 13:25:22 +01:00
Chris Hill-Scott
7a412873d3 Refactor for better string concatenation
Using `+` to concatenate strings isn’t very memory efficient. Not sure
if there are real-world implications for how it’s being used here, but
can’t hurt to use `.join` instead.

Rewriting it as a generator also lets us remove some unneeded variable
assignment.
2017-04-03 13:23:33 +01:00
minglis
f9264ea399 Merge pull request #879 from alphagov/bump-memory-on-prod
Bump memory on prod
2017-04-03 11:29:43 +01:00
Martyn Inglis
8f5e1318eb Spread out the scheduled jobs.
Before the longer tasks all ran on the hour, at midnight, 1 and 2.

Now we run one at midnight, one at quarter past, half past then at quarter too. Trying to spread the load.
2017-04-03 11:17:27 +01:00
Martyn Inglis
deaaa259f4 Bump the memory on delivery workers on prod to try and avoid memory issues which can cause delivery worker to fail. 2017-04-03 11:16:20 +01:00
Leo Hemsted
99d100c153 Merge pull request #878 from alphagov/fix-config
Can't set environs to nonetype
2017-03-31 17:25:36 +01:00
Leo Hemsted
243c0632ed add test 2017-03-31 17:18:18 +01:00
Leo Hemsted
1c4da5367f Can't set environs to nonetype 2017-03-31 17:10:43 +01:00
Chris Hill-Scott
585ef8e66a Bump utils to allow lists as placeholder values
Brings in:
- [ ] https://github.com/alphagov/notifications-utils/pull/128

Also adds a test to make sure that passing a dictionary as a value in
the `personalisation` argument works.
2017-03-31 17:02:54 +01:00
Leo Hemsted
27e4007fb5 Merge pull request #877 from alphagov/update-daily-performance-job-4am
Update daily performance job 4am
2017-03-31 16:57:16 +01:00
Ken Tsang
d5e8cb3354 Updated cf conf unit tests 2017-03-31 16:50:30 +01:00
Ken Tsang
316d8fdb0d Updated config to cloudfoundry_config 2017-03-31 16:37:04 +01:00
Ken Tsang
c633e193b0 Update config to enable performance platform 2017-03-31 15:54:29 +01:00
Ken Tsang
989713b0f1 Update config for daily perf job to start 4am 2017-03-31 15:33:41 +01:00
Leo Hemsted
c6ba4050fc Merge pull request #876 from alphagov/fix-notify-user
fix notify service user email
2017-03-31 14:21:56 +01:00
Rebecca Law
09cc3071be Merge pull request #875 from alphagov/fix-redis-test-bug
Stop notifications with test api key incrementing the cache
2017-03-30 15:18:56 +01:00
Leo Hemsted
8865f2db82 fix notify service user email 2017-03-30 15:05:03 +01:00
Rebecca Law
3838fb583c The redis cache for daily limits and template usage was being updated for notifications with a test api key.
This PR corrects that.
2017-03-30 13:43:44 +01:00
minglis
afea1f241c Merge pull request #874 from alphagov/revert-db-tasks-from-api
Revert db tasks from api
2017-03-30 13:16:41 +01:00