mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-31 15:15:38 -05:00
fix scheduled tasks
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
from datetime import timedelta
|
||||
|
||||
from flask import current_app
|
||||
from sqlalchemy import between, select, union
|
||||
from sqlalchemy import between, select, union, update
|
||||
from sqlalchemy.exc import SQLAlchemyError
|
||||
|
||||
from app import db, notify_celery, zendesk_client
|
||||
@@ -124,16 +124,20 @@ def check_job_status():
|
||||
.scalars()
|
||||
.all()
|
||||
)
|
||||
print(f"HERE IS JOBS {jobs_not_complete_after_30_minutes}")
|
||||
#print(f"HERE IS JOBS {jobs_not_complete_after_30_minutes}")
|
||||
|
||||
# temporarily mark them as ERROR so that they don't get picked up by future check_job_status tasks
|
||||
# if they haven't been re-processed in time.
|
||||
job_ids = []
|
||||
for job in jobs_not_complete_after_30_minutes:
|
||||
print(f"HERE IS A JOB {job}")
|
||||
job.job_status = JobStatus.ERROR
|
||||
print("CHANGED JOB STATUS TO ERROR")
|
||||
dao_update_job(job)
|
||||
#print(f"HERE IS A JOB {job}")
|
||||
#job.job_status = JobStatus.ERROR
|
||||
#print("CHANGED JOB STATUS TO ERROR")
|
||||
#dao_update_job(job)
|
||||
|
||||
db.session.execute(update(Job).where(Job.id == job.id).values(job_status=JobStatus.ERROR))
|
||||
db.session.commit()
|
||||
|
||||
job_ids.append(str(job.id))
|
||||
print(f"APPENDED NEW JOB ID TO LIST WHICH IS {job_ids}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user