mirror of
https://github.com/ansible/awx.git
synced 2026-05-18 06:47:41 -02:30
AC-1015 Changed where save_job_events task is started so that job events don't appear to be missing when they're stuck in the queue.
This commit is contained in:
@@ -26,7 +26,8 @@ import pexpect
|
||||
from kombu import Connection, Exchange, Queue
|
||||
|
||||
# Celery
|
||||
from celery import Task, task
|
||||
from celery import Celery, Task, task
|
||||
from celery.execute import send_task
|
||||
|
||||
# Django
|
||||
from django.conf import settings
|
||||
@@ -476,6 +477,12 @@ class RunJob(BaseTask):
|
||||
'''
|
||||
if job.status in ('pending', 'waiting'):
|
||||
job = self.update_model(job.pk, status='pending')
|
||||
# Start another task to process job events.
|
||||
if settings.BROKER_URL.startswith('amqp://'):
|
||||
app = Celery('tasks', broker=settings.BROKER_URL)
|
||||
send_task('awx.main.tasks.save_job_events', kwargs={
|
||||
'job_id': job.id,
|
||||
}, serializer='json')
|
||||
return True
|
||||
elif job.cancel_flag:
|
||||
job = self.update_model(job.pk, status='canceled')
|
||||
|
||||
Reference in New Issue
Block a user