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.
This commit is contained in:
Leo Hemsted
2018-03-09 16:34:47 +00:00
parent f0ca3d40de
commit 64bb94af9e
4 changed files with 46 additions and 3 deletions

View File

@@ -1365,7 +1365,7 @@ def test_process_incomplete_job_sms(mocker, sample_template):
@freeze_time('2017-01-01')
def test_process_incomplete_job_resets_start_time(mocker, sample_template):
mocker.patch('app.celery.tasks.s3.get_job_from_s3', return_value=load_example_csv('multiple_sms'))
save_sms = mocker.patch('app.celery.tasks.save_sms.apply_async')
mocker.patch('app.celery.tasks.save_sms.apply_async')
job = create_job(template=sample_template, notification_count=10,
created_at=datetime.utcnow() - timedelta(hours=2),