diff --git a/awx/main/tasks.py b/awx/main/tasks.py index e9c877444967..28f0b7308a42 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -1543,9 +1543,11 @@ def run(self, pk, **kwargs): status = res.status rc = res.rc - if status == 'timeout': - self.instance.job_explanation = "Job terminated due to timeout" - status = 'failed' + if status in ('timeout', 'error'): + self.instance.job_explanation = f"Job terminated due to {status}" + if status == 'timeout': + status = 'failed' + extra_update_fields['job_explanation'] = self.instance.job_explanation # ensure failure notification sends even if playbook_on_stats event is not triggered handle_success_and_failure_notifications.apply_async([self.instance.job.id])