Commit Graph

4853 Commits

Author SHA1 Message Date
Sakis
bab68280dc Merge pull request #1717 from alphagov/support-celery-multi
Support celery multi
2018-03-12 14:11:40 +00:00
Athanasios Voutsadakis
666a882412 Merge branch 'master' into support-celery-multi 2018-03-12 13:26:29 +00:00
Katie Smith
a54f238298 Merge pull request #1760 from alphagov/remove-job-stats-step-3
Migration to drop job_statistics table
2018-03-12 13:23:46 +00:00
Athanasios Voutsadakis
1d2df8b0b7 Merge branch 'master' into support-celery-multi 2018-03-12 12:44:28 +00:00
Katie Smith
cae38c5d54 Migration to drop job_statistics table 2018-03-12 12:38:06 +00:00
Katie Smith
dcb5cc3bf2 Merge pull request #1744 from alphagov/remove-job-stats-step-2
Delete job stats tasks, endpoints, DAO functions and model
2018-03-12 12:37:10 +00:00
Athanasios Voutsadakis
af67cc8446 Merge branch 'master' into support-celery-multi 2018-03-12 10:56:39 +00:00
Katie Smith
db6fa457b5 Delete JobStatistics model
Also changed the delete_service_and_all_associated_db_objects function
from the services DAO to remove reference to JobStatistics table.
2018-03-12 10:48:46 +00:00
Katie Smith
c843e15f81 Stop populating job-statistics table when creating a job 2018-03-12 10:48:46 +00:00
Katie Smith
b582f9f077 Delete Statistics DAO and some Jobs DAO functions
* Deleted the statistics DAO
  (this was used for the job statistics tasks)
* Deleted the functions in the jobs DAO which are no longer used
  (the functions that were used for the job-stats endpoints)
2018-03-12 10:48:46 +00:00
Katie Smith
44c4026df2 Delete job-stats endpoints
Deleted these endpoints:
* /service/<uuid:service_id>/job-stats/<job_id>
* /service/<uuid:service_id>/job-stats
2018-03-12 10:48:46 +00:00
Katie Smith
4f7dd1d258 Delete job statistics tasks
The tasks are no longer being used, so can be deleted safely:
* record_initial_job_statistics
* record_outcome_job_statistics
* timeout-job-statistics

The test file for the statistics tasks was deleted in a previous commit.
2018-03-12 10:48:46 +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
Athanasios Voutsadakis
59de1ce24d Merge branch 'master' into support-celery-multi 2018-03-09 16:58:37 +00:00
Athanasios Voutsadakis
2b6efd09b4 Set pool size to 1 for sender worker 2018-03-09 16:57:12 +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