try again

This commit is contained in:
Kenneth Kehl
2024-12-30 11:45:14 -08:00
parent 2878fb0070
commit bf497d8896
2 changed files with 7 additions and 2 deletions

View File

@@ -19,7 +19,7 @@ from app.dao.invited_org_user_dao import (
from app.dao.invited_user_dao import expire_invitations_created_more_than_two_days_ago from app.dao.invited_user_dao import expire_invitations_created_more_than_two_days_ago
from app.dao.jobs_dao import ( from app.dao.jobs_dao import (
dao_set_scheduled_jobs_to_pending, dao_set_scheduled_jobs_to_pending,
dao_update_job, dao_update_job_status_to_error,
find_jobs_with_missing_rows, find_jobs_with_missing_rows,
find_missing_row_for_job, find_missing_row_for_job,
) )
@@ -139,7 +139,7 @@ def check_job_status():
job_ids = [] job_ids = []
for job in jobs_not_complete_after_allotted_time: for job in jobs_not_complete_after_allotted_time:
job.job_status = JobStatus.ERROR job.job_status = JobStatus.ERROR
dao_update_job(job) dao_update_job_status_to_error(job)
job_ids.append(str(job.id)) job_ids.append(str(job.id))
if job_ids: if job_ids:
current_app.logger.info("Job(s) {} have not completed.".format(job_ids)) current_app.logger.info("Job(s) {} have not completed.".format(job_ids))

View File

@@ -176,6 +176,11 @@ def dao_update_job(job):
db.session.commit() db.session.commit()
def dao_update_job_status_to_error(job):
db.session.update(Job).where(Job.id == job.id).values(job_status=JobStatus.ERROR)
db.session.commit()
def dao_get_jobs_older_than_data_retention(notification_types): def dao_get_jobs_older_than_data_retention(notification_types):
stmt = select(ServiceDataRetention).where( stmt = select(ServiceDataRetention).where(
ServiceDataRetention.notification_type.in_(notification_types) ServiceDataRetention.notification_type.in_(notification_types)