Commit Graph

4875 Commits

Author SHA1 Message Date
Leo Hemsted
91fa475645 add new endpoint to get organisations and services for a user
contains orgs, and unmapped services.

the orgs contain nested services - services the user is a part of that
belong to that org.

the unmapped services are any services that the user is a part of that
either don't have an org or have one that the user doesn't know about
2018-03-14 15:39:31 +00:00
Leo Hemsted
efec57db01 replace user_schema with serialize method on user model
this is so that we can filter out inactive organisations and services

note: can't remove user schema completely, as we still use it in
POST /user to create new users
2018-03-14 15:39:31 +00:00
Chris Waszczuk
c6c56f9cdc Merge pull request #1758 from alphagov/filter-old-revoked-api-keys
Filter revoked api keys older than 7 days
2018-03-14 11:28:14 +00:00
Chris Waszczuk
08656bde5c Merge pull request #1752 from alphagov/handle-malformed-tokens-on-invite
Handle malformed invite tokens
2018-03-14 10:24:58 +00:00
Katie Smith
20eb329e49 Merge pull request #1765 from alphagov/update-to-processing-letter-response-files
Ensure update letter notification statuses task handles temporary failure
2018-03-14 09:31:33 +00:00
Katie Smith
41a9f5a06e Change format of the letter response file we expect
We were previously expecting the letter response files to be in the
format of 'NOTIFY.<datetime>.RSP.TXT' but the response files we receive
use '-' in the filenames instead of '.' which was causing an error when
we tried to get the date from the filename.
2018-03-14 09:25:51 +00:00
Katie Smith
79b5a735e2 Ensure update letter notification status always handles temporary failure
In the 'update-letter-notifications-statuses' task we want to ensure
that temporary failures are always handled, regardless of whether the
response file we receive contains unknown Sorted statuses or not.
2018-03-14 09:25:51 +00:00
chrisw
c98705696a filter revoked api keys older than 7 days 2018-03-13 17:24:14 +00:00
Katie Smith
2219dbf80b Merge pull request #1767 from alphagov/fix-migration
Fix revision numbers in migration 0177
2018-03-13 13:33:22 +00:00
Katie Smith
7b05ce75c0 Fix revision numbers in migration 0177 2018-03-13 13:26:20 +00:00
Katie Smith
d64af176a8 Merge pull request #1761 from alphagov/create-virus-scan-statuses
Add new virus scan statuses
2018-03-13 13:09:05 +00:00
Katie Smith
43c63a1644 Add new virus scan statuses
Added the following new notification statuses:
* pending_virus_check
* virus_scan_failed

If we decide to remove these statuses in future, we will need to replace
them with a different status in the notifications and
Notification_history tables where they are referenced, so
pending-virus-check will be replaced with sending, and virus-scan-failed
will be replaced with permanent-failure.
2018-03-13 12:03:14 +00:00
Venus Bailey
1523d28ec2 Merge pull request #1764 from alphagov/vb_billing_model
Add billing models and small alteration to billing tables (Pivotal #155511547)
2018-03-13 10:16:43 +00:00
Rebecca Law
68d658086b Merge pull request #1759 from alphagov/fix-bug-timeout-notifications
Fix the bug in timeout notifications.
2018-03-13 09:34:33 +00:00
venusbb
59898b7349 Add billing models and small alteration to billing tables 2018-03-12 18:19:26 +00:00
Sakis
32185fa587 Merge pull request #1762 from alphagov/reduce-worker-number
Reduce parallel worker processes to 3
2018-03-12 16:43:21 +00:00
Athanasios Voutsadakis
7268acdd38 Reduce parallel worker processes to 3
This was overly optimistic that 2G would be enough to handle 4 worker
processes as they are already exhausting the 2G limit.

Depending on performance we may need to tweak the memory instead/too.
2018-03-12 16:25:19 +00:00
Richard Chapman
3e48903b23 Merge pull request #1756 from alphagov/rc_send_template_preview_one_page
Updated the notification template endpoint to extract the pdf page
2018-03-12 14:46:38 +00:00
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
Rebecca Law
144356f096 Fix the bug in timeout notifications.
When the notification is timedout by the scheduled task if the service is expecting a status update, that update to the service would fail.
A test has been added.
2018-03-12 12:15:03 +00:00
Richard Chapman
79a6ce8782 * Updated imports to comply with pep8 for better maintainability
* Removed extra log messages so there are not two log messages being
generated per exception, as InvalidRequest also logs, updated the
InvalidRequest log message to include the exception type and exception
information
* Added extra asserts to ensure the exception messages are printed
2018-03-12 11:05:05 +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
Richard Chapman
04048aa220 Updated the notification template endpoint to extract the pdf page
before sending it to template preview. This stops the whole pdf file
being sent to template preview for each page which is really inefficient
on network traffic and memory usage.

* Added logic to the endpoint to extract the specific page requested
* Updated tests to add a mock for the new call to utils
* Added a new test case for exceptions in the PDF extraction process
2018-03-09 15:50:43 +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