|
@@ -12,32 +12,15 @@ Usage:
|
|
|
|
|
|
You can also specify the app to use with celeryd::
|
|
|
|
|
|
- $ celeryd -l info --app=myapp.celery
|
|
|
+ $ celery worker -l info --app=myapp
|
|
|
|
|
|
"""
|
|
|
from celery import Celery
|
|
|
|
|
|
+celery = Celery("myapp", broker="amqp://guest@localhost//")
|
|
|
|
|
|
-def debug_args(fun):
|
|
|
- from kombu.utils import reprcall
|
|
|
|
|
|
- def _inner(self, *args, **kwargs):
|
|
|
- print("CALL: %r" % reprcall(self.name, args, kwargs))
|
|
|
- return fun(*args, **kwargs)
|
|
|
- return _inner
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-celery = Celery("myapp")
|
|
|
-celery.conf.update(
|
|
|
- BROKER_URL="amqp://guest:guest@localhost:5672//",
|
|
|
- CELERY_ANNOTATIONS={
|
|
|
- "myapp.add": {"@__call__": debug_args},
|
|
|
- },
|
|
|
-)
|
|
|
-
|
|
|
-
|
|
|
-@celery.task
|
|
|
+@celery.task()
|
|
|
def add(x, y):
|
|
|
return x + y
|
|
|
|