Commit 98d42dd4 by Bach Dániel

Merge branch 'feature-fix-celery' into 'master'

Feature fix celery

See merge request !2
parents 988d0147 a435fc3a
......@@ -12,11 +12,9 @@ logger = logging.getLogger()
HOSTNAME = gethostname()
AMQP_URI = getenv('AMQP_URI')
CACHE_URI = getenv('CACHE_URI')
celery = Celery('agent', broker=AMQP_URI)
celery.conf.update(CELERY_CACHE_BACKEND=CACHE_URI,
CELERY_RESULT_BACKEND='cache',
celery.conf.update(CELERY_RESULT_BACKEND='amqp',
CELERY_TASK_RESULT_EXPIRES=300,
CELERY_QUEUES=(Queue(HOSTNAME + '.agent',
Exchange('agent', type='direct'),
......
......@@ -3,7 +3,8 @@ from twisted.internet import reactor, inotify
from twisted.python import filepath
from agentcelery import celery, HOSTNAME
from protocol import inotify_handler
from os import getenv, listdir, path, environ
from os import getenv, listdir, path, environ, kill, getpid
import signal
import logging
logging.basicConfig()
......@@ -33,15 +34,17 @@ def reactor_started():
def reactor_stopped(worker):
worker.worker.stop()
logger.info("Reactor stopped.")
kill(getpid(), signal.SIGKILL)
def main():
w = Worker(app=celery, concurrency=1,
pool_cls='threads',
hostname=HOSTNAME + '.agentdriver',
without_mingle=True, without_gossip=True,
loglevel=level)
reactor.callInThread(w.run)
reactor.callInThread(w.start)
notifier = inotify.INotify(reactor)
notifier.startReading()
notifier.watch(filepath.FilePath(SOCKET_DIR),
......
celery==3.0.24
celery==3.1.17
Twisted==13.1.0
threadpool==1.2.7
pylibmc==1.3.0
\ No newline at end of file
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