Commit Graph

4829 Commits

Author SHA1 Message Date
chrisw
c98705696a filter revoked api keys older than 7 days 2018-03-13 17:24:14 +00:00
Venus Bailey
40a0b8f03c Merge pull request #1750 from alphagov/vs_billing_tables
Facts and dimension tables for billing/reporting
2018-03-12 10:46:09 +00:00
kentsanggds
df5cdc239f Merge pull request #1736 from alphagov/pyup-update-pyjwt-1.5.3-to-1.6.0
Update pyjwt to 1.6.0
2018-03-12 10:34:42 +00:00
Chris Hill-Scott
abf31e7c58 Merge pull request #1745 from alphagov/match-on-partial-email-addresses
Match on partial email addresses and phone numbers in search
2018-03-12 09:48:50 +00:00
Leo Hemsted
f637d49871 Merge pull request #1757 from alphagov/process-job-fix
Process job fix
2018-03-09 17:28:21 +00:00
Leo Hemsted
ea2b0dfbc9 set processing_started in before earlier jobs are processed
process_incomplete_jobs loops through jobs processing them in a single
task. This means that if the job statuses are all 'error', and then the
process_incomplete_jobs task fails, the later jobs in the list that
never got picked up won't have their status set back to in progress, or
their processing_started time - so will be stuck in 'error' forever.

Instead, we set the job statuses to in progress and the start time to
now before we process any - so if the incomplete_jobs task fails later,
the jobs will be picked up (again) by the check_job_statuses task in
half an hour's time
2018-03-09 17:20:26 +00:00
Leo Hemsted
64bb94af9e set job status to error in the check_job_status scheduled task
the process_incomplete_jobs task runs through all incomplete jobs in
a loop, so it might not get a chance to update the processing_started
time of the last job before check_job_status runs again (every minute).
So before we even trigger the process_incomplete_jobs task, lets set
the status of the jobs to error, so that we don't identify them for
re-processing again.
2018-03-09 16:42:58 +00:00
Leo Hemsted
f0ca3d40de reset job processing time when re-processing incomplete jobs
we might stop processing jobs mid-way through if, for example, a
deploy or downscale kills the box working on it. We have a scheduled
task that identifies any job that we started processing more than half
an hour ago that is still processing.

However, we encountered a bug where we triggered the
process_incomplete_job multiple times, because the processing_started
of the job was still set to half an hour ago. If we reset the
processing_started to the current time, then it won't get picked up by
future runs of the check_job_status scheduled task.
2018-03-09 16:30:50 +00:00
Chris Hill-Scott
c7cc7822f7 Merge pull request #1738 from alphagov/refactored-csv-processing
Bring in refactored CSV processing
2018-03-09 14:28:48 +00:00
kentsanggds
d393342430 Merge branch 'master' into pyup-update-pyjwt-1.5.3-to-1.6.0 2018-03-09 14:21:10 +00:00
Rebecca Law
d9a0c8e7f0 Merge pull request #1755 from alphagov/replay-service-status-updates
Refactor service callback task
2018-03-09 12:06:38 +00:00
Rebecca Law
a3d04ca672 Improve log message 2018-03-09 12:01:08 +00:00
Rebecca Law
e95740a6b5 There was a problem with the worker that was sending the service updates for the notification.
The problem has been resolved but we need to replay the messages that are missing. We have been sent a file containing client_references for all the notificaitons that the service would needs updates for.
2018-03-09 11:06:47 +00:00
Chris Hill-Scott
c45f0ac516 Fix code style 2018-03-09 09:53:05 +00:00
Rebecca Law
031a19d387 Added a missing test, letter search has not yet been implemented. 2018-03-09 09:53:05 +00:00
Rebecca Law
e3a75d1b7d Notification_type is a required parameter, admin app always passes it in.
Normalise for notificaiton type.
Throw InvalidRequest exception is the notification type is invalid.
2018-03-09 09:53:05 +00:00
Rebecca Law
5f25fc0db4 The template type should be passed in when doing a search by recipent.
It is possible to search for a phone number when from the email notification page and get a SMS message in return.
This also helps to optimise the query.
2018-03-09 09:53:05 +00:00
Chris Hill-Scott
faaea75a99 Do more normalisation for better partial matching
Phone numbers sometimes contain stuff we normalise out. This matches
perfectly if we have a full phone number, because we can normalise the
thing we’re searching for in the same way as the search term.

With partial search terms we can’t do this completely, because we can’t
work out if ‘123’ is part of a UK number, an international number, the
start of the phone number, the last 3 digits, etc.

What we can do is remove some stuff that we can know will cause partial
search terms to not match:
- leading pluses
- leading `0`s
- any brackets
- any spaces
2018-03-09 09:51:50 +00:00
Chris Hill-Scott
209d75efd9 Match on partial email addresses in search
Users expect the search to work on partial email addresses ‘similar to
Gov.Pay’. We can’t have a situation where Pay are doing something better
than us 😜
2018-03-09 09:51:49 +00:00
venusbb
01ff06fc09 Rename tables, column and added indexes 2018-03-09 08:17:02 +00:00
Sakis
4767379fc7 Merge pull request #1753 from alphagov/document-new-worker-process
Describe process for creating a new worker app
2018-03-08 16:40:02 +00:00
Rebecca Law
00b17b5ad7 When we sent the service the status callback for a notification, we have all the information we need.
Which means we can remove the need to request the data from the database.
In order for the PR to be backwards compatible I have added an optional parameter "encrypted_status_update".
If this is not None then the new code is called.

The next PR will send the encrypted data to this task.

A final PR will remove the code that uses the database to get the notification and service callback api.
2018-03-08 16:17:41 +00:00
venusbb
5b0d047de3 Merge branch 'master' of https://github.com/alphagov/notifications-api into vs_billing_tables 2018-03-08 15:51:26 +00:00
kentsanggds
b0b0062b35 Merge pull request #1732 from alphagov/ken-hidden-in-json-response
Return `is_precompiled_letter` field as part of json for notification by id
2018-03-08 15:06:10 +00:00
Leo Hemsted
a777e13e4d Merge pull request #1754 from alphagov/revert-service-callback-eventlets
Revert service callback eventlets
2018-03-08 14:16:40 +00:00
Leo Hemsted
651c3062b9 retry service callbacks if the db queries fail
we don't expect them to fail, but they might if we accidentally
exhaust our connection pool. Just in case, lets retry.
2018-03-08 14:08:56 +00:00
Athanasios Voutsadakis
19129a1313 Describe process for creating a new worker app 2018-03-08 14:02:08 +00:00
Leo Hemsted
22f86aa1b5 Revert service callback worker eventlets
We have seen problems with the service callback workers due to the db
connection pool being exhausted. When the worker picks up the task, it
makes a db query to get the notification, a query to get the callback
url, and then closes the session before it makes the 3rd party request.

However, even closing the session before the (potentially lengthy)
web request wasn't enough - we've seen significant amounts of
`sqlalchemy.exc.TimeoutError`s.

This reverts commit 2dfbd93c7e
2018-03-08 13:35:53 +00:00
Chris Hill-Scott
f902ba476c Bring in refactored CSV processing
Shouldn’t be any functional changes here, just things being named more
clearly.
2018-03-08 13:12:00 +00:00
Chris Waszczuk
1a63847988 Merge pull request #1746 from alphagov/add-is-org-unique-rest-endpoint
Add endpoint to check for unique organisation names
2018-03-08 12:11:06 +00:00
Chris Hill-Scott
c029927fde Merge pull request #1733 from alphagov/remove-dvla
Remove anything to do with DVLA format letters
2018-03-08 10:58:34 +00:00
Richard Chapman
e6a3d63d3d Merge pull request #1749 from alphagov/pyup-update-sqlalchemy-1.2.4-to-1.2.5
Update sqlalchemy to 1.2.5
2018-03-08 09:56:11 +00:00
Richard Chapman
94dea42f6f Merge pull request #1747 from alphagov/add_precompiled_letters
Fixed bug only where only data being passed to TemplatePreview when JSON is required
2018-03-08 09:56:03 +00:00
Ken Tsang
23ce36dc48 Update response to return is_precompiled_letter 2018-03-07 23:03:03 +00:00
Ken Tsang
7011b90bd4 Refactor is_precompiled_letter to model 2018-03-07 23:03:03 +00:00
venusbb
a4c054124f work in progress 2018-03-07 17:23:52 +00:00
Chris Hill-Scott
ae0113a5de Merge pull request #1748 from alphagov/quis-patch-1
Add warning to Performance Platform command
2018-03-07 17:13:46 +00:00
Sakis
1782d824c8 Merge pull request #1751 from alphagov/fix-dockerfile
Install libffi-dev and python-dev in docker
2018-03-07 16:10:40 +00:00
Athanasios Voutsadakis
a84a70d791 Install libffi-dev and python-dev in docker
This is to allow us to build cffi
2018-03-07 15:56:41 +00:00
venusbb
5082d9d83c Increase datetime number of years from 20 to 50 2018-03-07 12:57:19 +00:00
venusbb
effaecbd49 added ft_billing and dm_datetime tables for report purpose 2018-03-07 12:46:11 +00:00
Katie Smith
f78cde61e7 Merge pull request #1743 from alphagov/remove-job-stats-step-1
Delete functions which call the job statistics tasks
2018-03-07 11:11:39 +00:00
Katie Smith
a85f5d3acf Merge pull request #1741 from alphagov/pyup-update-freezegun-0.3.9-to-0.3.10
Update freezegun to 0.3.10
2018-03-07 11:11:30 +00:00
Richard Chapman
d60e802f35 Removed the superfluous variable and pass through as it pulls it
automatically out of sys.exc_info.
2018-03-07 09:51:58 +00:00
Richard Chapman
7f32b06615 Replaced the JSONDecodeError with a ValueError as it was failing on
Jenkins.
2018-03-07 09:32:56 +00:00
Katie Smith
7f2e9f507e Delete functions which call the job statistics tasks
The JobStatistics table is going to be deleted. There are currently
3 tasks which use the JobStatistics model via the Statistics DAO, so we
need to make sure that these tasks aren't being used before they are
deleted in a separate PR.

This commit deletes:
* The `create_initial_notification_statistic_tasks` function which gets
used to call the `record_initial_job_statistics` task.
* The `create_outcome_notification_statistic_tasks` function which gets
used to call the `record_outcome_job_statistics` task.
* And the scheduling of the `timeout-job-statistics` scheduled task.
2018-03-07 09:23:29 +00:00
Katie Smith
0c1d5c12a3 Merge pull request #1699 from alphagov/persist-sorted-in-letter-response-file
Create and populate DailySortedLetter table
2018-03-07 09:06:33 +00:00
Katie Smith
f1db3c25eb Merge pull request #1740 from alphagov/pyup-update-pytest-3.4.1-to-3.4.2
Update pytest to 3.4.2
2018-03-07 09:06:21 +00:00
pyup-bot
e2a308a703 Update sqlalchemy from 1.2.4 to 1.2.5 2018-03-06 19:17:29 +00:00
Richard Chapman
cf2a506b3b Removed the import and directly used json.decoder.JSONDecodeError
as it was failing on Jenkins.
2018-03-06 18:20:45 +00:00