Updated zeromq callback to receive callback port via environment variable. Changed production, development and unit tests to all use different ports/queues for the callback.

This commit is contained in:
Chris Church
2014-02-26 14:11:59 -05:00
parent 78bba13bbb
commit 8e61d17cb4
8 changed files with 43 additions and 25 deletions

View File

@@ -388,8 +388,7 @@ class RunJob(BaseTask):
env['ANSIBLE_CALLBACK_PLUGINS'] = plugin_dir
env['REST_API_URL'] = settings.INTERNAL_API_URL
env['REST_API_TOKEN'] = job.task_auth_token or ''
if settings.BROKER_URL.startswith('amqp://'):
env['BROKER_URL'] = settings.BROKER_URL
env['CALLBACK_CONSUMER_PORT'] = settings.CALLBACK_CONSUMER_PORT
if getattr(settings, 'JOB_CALLBACK_DEBUG', False):
env['JOB_CALLBACK_DEBUG'] = '2'
elif settings.DEBUG:
@@ -502,14 +501,9 @@ class RunJob(BaseTask):
Hook for actions to run after job/task has completed.
'''
super(RunJob, self).post_run_hook(job, **kwargs)
# Send a special message to this job's event queue after the job has run
# to tell the save job events task to end.
if settings.BROKER_URL.startswith('amqp://'):
pass
# Update job event fields after job has completed (only when using REST
# API callback).
else:
if not settings.CALLBACK_CONSUMER_PORT:
for job_event in job.job_events.order_by('pk'):
job_event.save(post_process=True)