mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-16 10:12:32 -05:00
try again
This commit is contained in:
@@ -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))
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user