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:
parent
9a7d77ffe3
commit
641c8d8e05
@ -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,
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user