문제

I started playing around with Celery and RabbitMQ this morning and defined some basic tasks to see how the performance will improve on my server.

I have added my rabbitmq user, vhosts and set my permissions. Started my RabbitMQ server

In a very detailed tutorial I found these guys use celerybeat and celeryd to see the status of some task, and also to execute them.

the detailed tutorial by Rich Leland

Do you also need celery somehow, or are the steps I have taken enough?

Nowhere did I see any info or notes about this... just asking

도움이 되었습니까?

해결책

Well, you'll need to have some sort of celery process running in order to handle tasks in the queue. The celeryd process listens on the queue, and executes tasks according to your settings. If you don't have a celeryd process running, you'll just be adding tasks to the queue, but never emptying it.

If you're just interested in seeing your queues, I'd recommend installing the RabbitMQ management plugin.

다른 팁

http://ask.github.com/celery/getting-started/introduction.html

  1. Start your RabbitMQ server
  2. Define your celeryconfig.py
  3. Start your celery daemon: celeryd

RabbitMQ has a guest login, so that's a faster way to get started. Put this in celeryconfig.py:

import sys
sys.path.append('.')

BROKER_HOST = "localhost"
BROKER_PORT = 5672
BROKER_USER = "guest"
BROKER_PASSWORD = "guest"
BROKER_VHOST = "/"

CELERY_RESULT_BACKEND = "amqp"

CELERY_IMPORTS = ("tasks",)

For a quick test, put this in tasks.py:

from celery.task import task

@task
def add(x, y):
    return x + y

if __name__ == "__main__":
    result = add.delay(4, 4)
    result.wait() 

Start celeryd in the same directory has celeryconfig.py and tasks.py:

celeryd --loglevel=INFO

Finally, run tasks.py

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top