Commit Graph

63 Commits

Author SHA1 Message Date
Leo Hemsted
2c758cbccd use new send-jobs-to-dvla task instead of send-files-to-dvla
the tasks (on the ftp app) do the same thing, but to improve clarity
i've renamed it to jobs, because we'll be adding a notifications one
soon
2017-09-12 17:28:07 +01:00
Rebecca Law
e32abb0ada Merge pull request #1221 from alphagov/ken-no-letters-when-trial
Stop letters when service is in trial
2017-09-05 15:33:50 +01:00
Rebecca Law
19f964a90b Added a check that the call is not using a test api key.
Removed the tests for trial mode service for the scheduled tasks and the process job.
Having the validation in the POST notification and create job endpoint is enough.
Updated the test_service_whitelist test because the order of the array is not gaurenteed.
2017-09-04 17:24:41 +01:00
Ken Tsang
d391919677 Refactored to check trial when running scheduled job 2017-08-30 22:30:05 +01:00
Ken Tsang
41a71c703b Refactor test 2017-08-30 16:04:10 +01:00
Katie Smith
a1a5fdedb1 Send results of processing-time query to performance platform 2017-08-30 14:40:10 +01:00
Leo Hemsted
cf2d803db1 Merge pull request #1205 from alphagov/perf-stats
Perf stats refactor
2017-08-29 10:44:09 +01:00
Leo Hemsted
e85b621cbc make perf platform client handle more stuff sensibly
specifically, all of the performance platform specific data layout now
happens in performance_platform_client.py - stuff like setting the
_timestamp, period etc, and the perf platform-specific nomenclature is
all handled there.
2017-08-24 17:10:42 +01:00
Ken Tsang
1b35731fb2 Refactor code
- updated dao_get_letter_jobs_by_status to dao_get_letter_job_ids_by_status to return array of strings
2017-08-24 11:57:46 +01:00
Leo Hemsted
412c87cfc8 pycodestyle 2017-08-24 10:52:47 +01:00
Leo Hemsted
bd2682b521 add new performance-platform section to cf config
it's a new cf-service we've got to create, that contains endpoints
and the bearer tokens for them.
2017-08-23 18:14:35 +01:00
Ken Tsang
451c5a9f1a Made celery task arg a tuple 2017-08-23 18:05:48 +01:00
Leo Hemsted
89f4f5173e refactor performance platform code
so that it doesn't appear generic when it's actually specific to
sending the daily notification totals. To do this, split it out into a
separate performance_platform directory, containing the business logic,
and make the performance_platform_client incredibly thin - all it
handles is adding ids to payloads, and sending stats.

Also, some changes to the config (not all done yet) since there is one
token per endpoint, not one for the whole platform as we'd previously
coded
2017-08-23 17:37:29 +01:00
Ken Tsang
4fb5e68ce7 Refactor code
- Created TaskNames for DVLA_FILES rather than have DVLA_FILES in QueueNames
- Removed PROCESS_FTP from all_queues() as this was causing problems in picking up letter job tasks
- Created test to ensure that we don't arbitrarily add queue names to all_queues
2017-08-23 13:22:07 +01:00
Ken Tsang
b2b74e2b5d Fixed bug in letter job schedule 2017-08-23 13:22:07 +01:00
Ken Tsang
18881cd580 Add scheduled letter jobs 2017-08-23 13:22:07 +01:00
Imdad Ahad
94605d31fa Change how we populate and retrieve MonthlyBilling totals:
1. For both email and sms, store [] in monthly_totals if
there is no billing data (no notifications sent etc.) and
return this via the API

2. General refactoring of indentation
2017-08-15 16:09:42 +01:00
Imdad Ahad
63e1167098 Make sure we update the correct month for billing:
When populating the monthly billing records on a schedule, we need
to ensure the correct month is being updated.

As an example, if the current datetime is 31 Mar 2016, 23:00. The
BST equivalent is the 1st April. Therefore we need to ensure we
update billing for April, not March. This takes care of that.
2017-08-11 16:57:17 +01:00
Rebecca Law
c1f2634c90 Removed month and year and replaced it with start_date and end_date.
This will allow us to sort the data properly.
2017-07-26 13:19:17 +01:00
Rebecca Law
91f29517eb Merge branch 'master' into month-billing-table 2017-07-24 15:17:36 +01:00
Rebecca Law
3e2b8190b9 - Added a scheduled task to create or update billing for the month, yesterday is used to calculate the start and end date for the month.
- The new task has not been added to the beat application yet.
- Added an updated_at column to the monthly billing table, we may want to only calculate from the last updated date rather than the entire month.
2017-07-24 15:13:18 +01:00
Leo Hemsted
614880f6d9 send to send-sms-tasks and send-email-tasks instead of send-tasks 2017-07-21 13:49:37 +01:00
Imdad Ahad
c8c47f44a9 Don't update older status in timeout notifications task 2017-07-10 14:09:30 +01:00
Imdad Ahad
f0ffbad77d Fix syncing issue with Notification statuses:
The timeout_notifications job runs daily and does not correctly
update both the status fields to keep them in sync.
2017-07-06 12:30:08 +01:00
Imdad Ahad
1dacc6c3a3 Updates:
* Skip the decorated tests as that doesn't work as we expect
* Remove magic numbers in tests
2017-06-13 15:22:31 +01:00
Imdad Ahad
f29ebb34f6 Add scheduled task to delete response files older than 7 days 2017-06-13 12:40:58 +01:00
Imdad Ahad
c6db12731a Add test to check dvla files (unexpected) are not removed 2017-06-08 13:06:24 +01:00
Imdad Ahad
c4a89b77e3 Add task to remove transformed dvla files:
* Runs at 4:40am
* Remove files older than 7 days and only two day's worth
2017-06-07 16:39:23 +01:00
Imdad Ahad
74a8905be9 Seperate deletion of jobs:
* Two separate jobs, one for sms&email and another for letter
* Change celery task for delete to accept template type filter
* General refacor of tests to make more readable
2017-06-06 16:02:01 +01:00
Imdad Ahad
56c3f3cf7c Add task to delete inbound sms everyday at 1am 2017-06-02 16:10:27 +01:00
Martyn Inglis
75c5e5e5d5 Merge branch 'master' into redo-queue-visibitlity-timeout
Conflicts:
	app/notifications/process_notifications.py
	app/v2/notifications/post_notifications.py
2017-05-30 10:18:18 +01:00
Rebecca Law
f555c7a73b Refactor tests to use the create_notication in tests.app.db 2017-05-25 11:41:07 +01:00
Martyn Inglis
2591d3a1df This massive set of changes uses the new queue names object throughout the app and tests.
Lots of changes, all changing the line of code that puts things into queues, and the code that tests that.
2017-05-25 10:51:49 +01:00
Rebecca Law
383dee3bb2 Updated the serialization of Notification.scheduled_for to include minutes. 2017-05-24 14:52:32 +01:00
Rebecca Law
96b0e42959 Merge branch 'master' into schedule-api-notification
Conflicts:
	app/celery/scheduled_tasks.py
	tests/app/celery/test_scheduled_tasks.py
2017-05-24 13:21:22 +01:00
Martyn Inglis
a5c71ea907 New task to use the new DAO method to delete the data by type 2017-05-23 13:40:36 +01:00
Rebecca Law
9bfba52f53 Add pending flag to scheduled_notifications.
Set pending flag to false when the notification has been sent to provider task.
2017-05-22 15:07:16 +01:00
Rebecca Law
3a3161ecc4 Merge branch 'master' into schedule-api-notification
Conflicts:
	app/celery/scheduled_tasks.py
	app/v2/notifications/post_notifications.py
	tests/app/celery/test_scheduled_tasks.py
2017-05-22 14:05:57 +01:00
Rebecca Law
973cc2c4c9 Changed the scheduled_for datetime to only send and hour of a day to send.
Also expect the date being passed in is BST. The date is converted to UTC before saving. And converted to BST when returning a notification.
2017-05-17 15:06:15 +01:00
Rebecca Law
2e078f9fc8 Add scheduled task to send scheduled notifcations.
Fix the query to fetch scheduled notifications.
2017-05-16 13:47:22 +01:00
Martyn Inglis
8818bd5dba Scheduled task to call the timeout function 2017-05-11 15:22:57 +01:00
Leo Hemsted
935e566284 add tests for letters not getting excluded 2017-04-19 14:22:25 +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
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
imdadahad
c11f4b5d5d Merge pull request #829 from alphagov/feat-add-endpoint-for-service-monthly-usage-stats
Add endpoint for service monthly usage stats by template
2017-03-09 16:12:22 +00:00
Imdad Ahad
a4dc614ef7 Restore dao_create_template and use custom template fixture instead 2017-03-08 13:03:44 +00:00
Imdad Ahad
8272a4388d Add dao method to get template stats per month in financial year for service 2017-03-08 12:01:38 +00:00
Imdad Ahad
37341e7a62 Updates:
* Add notify user id in config
* Add dao method to get provider history versions along with tests
* BUG: Provider switching did not handle case where priorities were equal. This
* adds a fix to properly cover this case along with tests
2017-03-03 10:54:20 +00:00
Imdad Ahad
d805985a4e Refactor tests to use cleaner fixture and be more verbose in tests 2017-02-27 13:18:42 +00:00
Imdad Ahad
204d72830f Update switch task to use sent_at and newer db helpers 2017-02-24 13:41:32 +00:00