Commit 553e5137 by Simon János

task queue util added

parent 6e4f4ff0
from celery import Celery
from oslo_config import cfg
RPC_CLI_OPTS = [
cfg.URIOpt('broker-url', dest='broker_url', default='amqp://cloud:password@localhost:5672/circle'),
# cfg.URIOpt('broker-url', dest='broker_url', default='amqp://guest:guest@localhost:5672//')
cfg.IntOpt('operation-timeout', dest='operation_timeout', default='30', help='Operation timeout in seconds'),
]
cfg.CONF.register_cli_opts(RPC_CLI_OPTS, 'rpc')
cfg.CONF.register_opt(cfg.StrOpt('datastore-root', dest='datastore_root', default='/datastore',
help='Path to datastore dir on storage node'), 'storage')
class Tasks(object):
QUEUE = Celery('orchestrator', broker=cfg.CONF.rpc.broker_url)
QUEUE.conf.update(
CELERY_RESULT_BACKEND='amqp',
CELERY_TASK_RESULT_EXPIRES=300
)
@staticmethod
def send_task(name, args=None):
return Tasks.QUEUE.send_task(name, args=args, queue='cloud-9583.vm.fast')
...@@ -3,16 +3,17 @@ envlist = py27, py34 ...@@ -3,16 +3,17 @@ envlist = py27, py34
[dependencies] [dependencies]
production = production =
enum34 aenum
voluptuous voluptuous
oslo.config oslo.config
oslo.log oslo.log
falcon falcon
; celery celery==3.1.17
test = test =
pytest pytest
pytest-pylint pytest-pylint
flake8 flake8
mockito
; flower ; flower
[testenv] [testenv]
......
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