log when notifications fail to send

* If a job does not finish in the 5 second timeout. Let the user know
that we failed to even try to send the notification.
This commit is contained in:
chris meyers
2020-03-20 08:27:22 -04:00
parent d5bdfa908a
commit 47f5c17b56
2 changed files with 23 additions and 1 deletions

View File

@@ -609,7 +609,7 @@ def handle_success_and_failure_notifications(job_id):
while retries < 5:
if uj.finished:
uj.send_notification_templates('succeeded' if uj.status == 'successful' else 'failed')
break
return
else:
# wait a few seconds to avoid a race where the
# events are persisted _before_ the UJ.status
@@ -618,6 +618,8 @@ def handle_success_and_failure_notifications(job_id):
time.sleep(1)
uj = UnifiedJob.objects.get(pk=job_id)
logger.warn(f"Failed to even try to send notifications for job '{uj}' due to job not being in finished state.")
@task(queue=get_local_queuename)
def update_inventory_computed_fields(inventory_id):