1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-02 01:21:21 +03:00

Check the result of signal_start when adding a schedule and mark the

task as failed if it failed to signal the starting
This commit is contained in:
Matthew Jones 2014-04-03 13:55:16 -04:00
parent 9a7d77ffe3
commit 641c8d8e05
2 changed files with 6 additions and 2 deletions

View File

@ -102,7 +102,7 @@ class UnifiedJobTemplate(PolymorphicModel, CommonModelNameNotUnique):
# max_length=32,
# choices=[],
#)
next_job_run = models.DateTimeField( # FIXME: Calculate from schedules.
next_job_run = models.DateTimeField(
null=True,
default=None,
editable=False,

View File

@ -79,7 +79,11 @@ def tower_periodic_scheduler(self):
template = schedule.unified_job_template
schedule.save() # To update next_run timestamp.
new_unified_job = template.create_unified_job(launch_type='scheduled', schedule=schedule)
new_unified_job.signal_start()
can_start = new_unified_job.signal_start()
if not can_start:
new_unified_job.status = 'failed'
new_unified_job.job_explanation = "Scheduled job could not start because it was not in the right state or required manual credentials"
new_unified_job.save(update_fields=['job_status', 'job_explanation'])
@task()
def notify_task_runner(metadata_dict):