Commit Graph

3117 Commits

Author SHA1 Message Date
Rebecca Law
f73b5140ed Bah! style check 2017-07-25 17:47:08 +01:00
Rebecca Law
b62ee8380c Use BST to calculate monthly billing 2017-07-25 17:38:53 +01:00
Rebecca Law
3d3703750c Merge pull request #1126 from alphagov/month-billing-table
Add transactional for new query
2017-07-25 16:07:53 +01:00
Rebecca Law
e23d38de26 Fix bug in get rates function. 2017-07-25 15:50:14 +01:00
Leo Hemsted
0ce9b94c36 Merge pull request #1075 from alphagov/letter-api-refactor
Letter api step 1 - refactor
2017-07-25 14:53:39 +01:00
Rebecca Law
5612ca023e - Add transactional
- Rename function for clarity
2017-07-25 14:26:42 +01:00
Leo Hemsted
8c7127da3b Merge pull request #1125 from alphagov/pyup
bump test requirements
2017-07-25 12:04:12 +01:00
Rebecca Law
48c02ba31f Merge pull request #1091 from alphagov/month-billing-table
Month billing table
2017-07-25 12:03:40 +01:00
Rebecca Law
d2a1da9ea6 Removed comment 2017-07-25 11:44:39 +01:00
Rebecca Law
eaf5cbb868 Add labels to query so that the named tuples can be referenced later.
Remove unnecessary function
2017-07-25 11:43:41 +01:00
Leo Hemsted
cc32cff32a bump test requirements
also ignore celery improvements
2017-07-25 11:40:12 +01:00
Imdad Ahad
dafab0201a Merge pull request #1096 from alphagov/imdad-feat-remove-unused-wheels-deployment
Remove wheels-ing on deployment
2017-07-25 11:14:01 +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
6059dcfe11 Merge pull request #1093 from alphagov/queue-split-part-2
[2/3] send to new queues
2017-07-24 15:11:37 +01:00
Imdad Ahad
6da3d3ed0b Remove wheels-ing on deployment 2017-07-21 14:26:59 +01:00
Chris Hill-Scott
27b5c883bc Merge pull request #1087 from alphagov/bump-utils-17.5.5
Bump utils
2017-07-21 14:09:43 +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
Rebecca Law
0e3d84c91c Merge pull request #1084 from alphagov/add-logging-to-sms-drs
Add logging to SMS delivery receipts
2017-07-21 12:29:45 +01:00
Leo Hemsted
cfbf7ba2d1 Merge pull request #1092 from alphagov/old-queue-split
[1/3] add separate send-sms and send-email queues
2017-07-21 11:31:48 +01:00
Rebecca Law
11950936a1 Merge pull request #1095 from alphagov/add-id-for-simulated-notifications
Fix for simulated notifications.
2017-07-21 09:23:50 +01:00
Rebecca Law
d4bbca2592 Fix for simulated notifications.
When a post is made for a simulated number the id is empty in the notificaiton object that we return.
This fixes that.
2017-07-20 17:56:51 +01:00
Chris Hill-Scott
e65619cb90 Bump utils
Brings in:
- [ ] https://github.com/alphagov/notifications-utils/pull/182
2017-07-20 17:32:44 +01:00
Leo Hemsted
4d33040653 add separate send-sms and send-email queues
we're reading from those two queues as well as teh existing send queue,
however for now we don't send anything to them
2017-07-20 16:19:38 +01:00
Leo Hemsted
79e33073c9 raise 404 when unknown url
consistent with other endpoints.

also refactor of notification_schema to separate some fns to a different file
2017-07-20 15:23:51 +01:00
Leo Hemsted
9caf45451e make persist_notification require kwargs
when functions get as big as that, it's confusing to try and work out what
things are what. By including a * as the first arg, we require that anyone
calling the function has to use kwargs to reference the parameters
2017-07-19 17:02:19 +01:00
Leo Hemsted
2be194d9ce refactor post_notification to separate sms/email and letter flows 2017-07-19 17:02:19 +01:00
Leo Hemsted
7f4eec79e4 add POST letter schema
similar to sms/email, however, for consistency with response values
and internal storage, rather than supplying an "email_address" field
or a "phone_number" field, supply an "address_line_1" and "postcode"
field within the personalisation object.
2017-07-19 17:02:19 +01:00
Leo Hemsted
49bbd1a29b Merge pull request #1090 from alphagov/revert-celery-4
Revert celery4
2017-07-19 16:57:31 +01:00
Rebecca Law
793248a74f Fix data migration merge conflict 2017-07-19 15:47:12 +01:00
Leo Hemsted
6c61a3fc2a Revert celery4
Revert the following three pull requests:
https://github.com/alphagov/notifications-api/pull/1085
https://github.com/alphagov/notifications-api/pull/1086
https://github.com/alphagov/notifications-api/pull/1088

celery 4.0.2 looked promising, however, on staging under mild load
(5/sec api calls) the performance was actually worse than 3.1.25
2017-07-19 15:17:19 +01:00
Rebecca Law
bc4afb25ae Merge branch 'master' into month-billing-table 2017-07-19 14:33:19 +01:00
Rebecca Law
301339e689 Merge branch 'master' into add-logging-to-sms-drs 2017-07-19 14:30:51 +01:00
Rebecca Law
9400988d72 Monthly billing - part 1
This is still a work in progress but it would be good to get some eyes on it.
This commit includes creating and updating a row in the monthly billing table and a method to fetch the results.
There is a command to populate the monthly billing for a service and month so we can try it out.
The total cost at the moment are wrong, they do not take into account the free allowance - see notes below about adding that to the table.
Left to do:
create a nightly task to run to update the monthly totals.
create an endpoint to return the yearly billing, the current day will need to be calculated on the fly and added to the totals.
Add the free allowance into the total costs.
2017-07-18 18:21:35 +01:00
Imdad Ahad
92755c3417 Merge pull request #1078 from alphagov/imdad-migration-drop-old-noti-status
3/3 Drop old notification status column
2017-07-18 11:52:09 +01:00
Leo Hemsted
965755bf13 Merge pull request #1088 from alphagov/kombu-bump
update kombu version to prevent 100% CPU usage
2017-07-17 14:42:45 +01:00
Leo Hemsted
bfdf9bc9a0 update kombu version to prevent 100% CPU usage
This pulls in the most recent version of celery/kombu/master - it
prevents situations where the celery MainProcess would consume 100%
CPU while not distributing any tasks to the workers.

Note: If, locally, you already have kombu==4.0.2, you'll have to run
pip install --upgrade https://github.com/celery/kombu/zipball/b2f21289
to get the new version.
2017-07-17 14:21:01 +01:00
Rebecca Law
4b05c32b62 Create a new table to warehouse the monthly billing numbers 2017-07-13 17:22:11 +01:00
Leo Hemsted
6d1ec3eb44 Merge pull request #1086 from alphagov/celery4
remove `sqs` from region - this is only needed in boto2
2017-07-13 13:18:58 +01:00
Leo Hemsted
d577855eb3 remove sqs from region - this is only needed in boto2
We don't use boto2 on the api anymore, not since celery 4.0.2

Note - if you run locally with boto2 still installed you'll see errors
that complain about things like:

boto.exception.SQSError: SQSError: 403 Forbidden
<?xml version="1.0"?><ErrorResponse xmlns="http://queue.amazonaws.com/doc/2012-11-05/"><Error><Type>Sender</Type><Code>SignatureDoesNotMatch</Code><Message>Credential should be scoped to a valid region, not 'queue'. </Message><Detail/></Error><RequestId>52207ca4-9131-58cb-89ae-2d45f06623a3</RequestId></ErrorResponse>

If so, make sure boto2 is completely uninstalled.
2017-07-13 13:16:28 +01:00
Leo Hemsted
2aae0f9300 Merge pull request #1085 from alphagov/celery4
Celery 4 (attempt 2)
2017-07-13 11:54:32 +01:00
Leo Hemsted
8679fc35d1 pin kombu to fix SQS issues
Kombu is a library that celery uses under the hood. Kombu is pinned to
a specific commit that brings in fixes for SQS - see
https://github.com/celery/kombu/pull/693. Kombu v4.0.2 (which ships
with celery v4.0.2) doesn't work with SQS due to problems with their
use of boto2, so Kombu migrated to boto3 - We're waiting for that to
get a release version, and then to get a new version of celery that
pulls that in. Until that point, we should override the kombu version
to get these SQS fixes.

Additionally, we don't need boto2 any more :)
2017-07-13 11:31:45 +01:00
Leo Hemsted
3331491ef1 add pycurl to requirements
it's needed by kombu 4.0.2.

Also moved import about
2017-07-12 17:17:02 +01:00
Imdad Ahad
555dac76a8 Remove old notification status column 2017-07-12 16:24:18 +01:00
Leo Hemsted
4ced59f7d3 remove pycurl from reqs 2017-07-12 16:01:22 +01:00
Rebecca Law
49d1f52aef Fix code style 2017-07-12 15:49:43 +01:00
Rebecca Law
d18ce47114 Make sure we don't log the phone number 2017-07-12 15:32:59 +01:00
Rebecca Law
6fb4e16067 Added logging to show the entire form posted to us by the SMS client providers.
This can be useful information when debugging what happened to a notificaiton.
Recently there was a discrepancy between the failure type used by each provider for a particular number, this logging would have helped.
2017-07-12 14:19:39 +01:00
Leo Hemsted
1a03248317 temp fix to sort out circular imports 2017-07-12 13:02:19 +01:00
kentsanggds
eb8cf26c80 Merge pull request #1073 from alphagov/ken-update-organisation-dao-model-rest
Update organisation dao model rest
2017-07-12 12:57:06 +01:00