Merge pull request #2639 from alphagov/remove-loadtesting-db-migration

remove loadtesting from the database
This commit is contained in:
Leo Hemsted
2019-11-05 15:14:23 +00:00
committed by Rebecca Law
6 changed files with 169 additions and 13 deletions

View File

@@ -13,7 +13,7 @@ from app.celery.tasks import process_job
from app.config import QueueNames, TaskNames
from app.dao.invited_org_user_dao import delete_org_invitations_created_more_than_two_days_ago
from app.dao.invited_user_dao import delete_invitations_created_more_than_two_days_ago
from app.dao.jobs_dao import dao_set_scheduled_jobs_to_pending
from app.dao.jobs_dao import dao_set_scheduled_jobs_to_pending, find_jobs_with_missing_rows, find_missing_row_for_job
from app.dao.jobs_dao import dao_update_job
from app.dao.notifications_dao import (
is_delivery_slow_for_provider,
@@ -222,3 +222,27 @@ def check_templated_letter_state():
message=msg,
ticket_type=zendesk_client.TYPE_INCIDENT
)
@notify_celery.task(name='find-missing-rows-from-completed-jobs')
def find_missing_rows_from_completed_jobs():
jobs_and_job_size = find_jobs_with_missing_rows()
for x in jobs_and_job_size:
missing_rows = find_missing_row_for_job(jobs_and_job_size.job_id, jobs_and_job_size.notification_count)
# job = dao_get_job_by_id(job_id)
# db_template = dao_get_template_by_id(job.template_id, job.template_version)
#
# TemplateClass = get_template_class(db_template.template_type)
# template = TemplateClass(db_template.__dict__)
#
# for row in RecipientCSV(
# s3.get_job_from_s3(str(job.service_id), str(job.id)),
# template_type=template.template_type,
# placeholders=template.placeholders
# ).get_rows():
# if row.index == job_row_number:
# notification_id = process_row(row, template, job, job.service)
# current_app.logger.info("Process row {} for job {} created notification_id: {}".format(
# job_row_number, job_id, notification_id))
pass