Commit 5adddfa3 by Szeberényi Imre

Queue and Exchange names are generated from host name

parent 9635d802
......@@ -3,23 +3,26 @@ from twisted.internet import reactor # threads
from celery.result import TimeoutError
from celery import Celery
from kombu import Queue, Exchange
from os import getenv
from os import getenv, environ
from socket import gethostname
from threading import Event
import logging
logging.basicConfig()
logger = logging.getLogger()
level = environ.get('LOGLEVEL', 'INFO')
logger.setLevel('INFO')
HOSTNAME = gethostname().split('.')[0]
AMQP_URI = getenv('AMQP_URI')
celery = Celery('agent', broker=AMQP_URI)
celery.conf.update(CELERY_RESULT_BACKEND='amqp',
ret = celery.conf.update(CELERY_RESULT_BACKEND='amqp',
CELERY_TASK_RESULT_EXPIRES=300,
CELERY_QUEUES=(Queue(HOSTNAME + '.agent',
Exchange('agent', type='direct'),
routing_key='agent'), ))
Exchange(HOSTNAME + '.agent', type='direct'),
routing_key=HOSTNAME + '.agent'), ))
logger.info('agentcelery: clelery.conf.update: %s', ret)
def send_command(vm, command, *args, **kwargs):
uuid = kwargs.get('uuid', None)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment