mirror of
https://github.com/ansible/awx.git
synced 2026-03-20 18:37:39 -02:30
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:
@@ -102,7 +102,7 @@ class UnifiedJobTemplate(PolymorphicModel, CommonModelNameNotUnique):
|
|||||||
# max_length=32,
|
# max_length=32,
|
||||||
# choices=[],
|
# choices=[],
|
||||||
#)
|
#)
|
||||||
next_job_run = models.DateTimeField( # FIXME: Calculate from schedules.
|
next_job_run = models.DateTimeField(
|
||||||
null=True,
|
null=True,
|
||||||
default=None,
|
default=None,
|
||||||
editable=False,
|
editable=False,
|
||||||
|
|||||||
@@ -79,7 +79,11 @@ def tower_periodic_scheduler(self):
|
|||||||
template = schedule.unified_job_template
|
template = schedule.unified_job_template
|
||||||
schedule.save() # To update next_run timestamp.
|
schedule.save() # To update next_run timestamp.
|
||||||
new_unified_job = template.create_unified_job(launch_type='scheduled', schedule=schedule)
|
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()
|
@task()
|
||||||
def notify_task_runner(metadata_dict):
|
def notify_task_runner(metadata_dict):
|
||||||
|
|||||||
Reference in New Issue
Block a user