Download 2.4-archived PDF

Transcript
Celery Documentation, Release 2.4.7
8.6.2 Can I use Celery with ActiveMQ/STOMP?
Answer: No. It used to be supported by Carrot, but is not currently supported in Kombu.
8.6.3 What features are not supported when not using an AMQP broker?
This is an incomplete list of features not available when using the virtual transports:
• Remote control commands (supported only by Redis).
• Monitoring with events may not work in all virtual transports.
• The header and fanout exchange types (fanout is supported by Redis).
8.7 Tasks
8.7.1 How can I reuse the same connection when applying tasks?
Answer: See the BROKER_POOL_LIMIT setting. This setting will be enabled by default in 3.0.
8.7.2 Can I execute a task by name?
Answer: Yes. Use celery.execute.send_task(). You can also execute a task by name from any language
that has an AMQP client.
>>> from celery.execute import send_task
>>> send_task("tasks.add", args=[2, 2], kwargs={})
<AsyncResult: 373550e8-b9a0-4666-bc61-ace01fa4f91d>
8.7.3 How can I get the task id of the current task?
Answer: The current id and more is available in the task request:
@task
def mytask():
cache.set(mytask.request.id, "Running")
For more information see Context.
8.7.4 Can I specify a custom task_id?
Answer: Yes. Use the task_id argument to apply_async():
>>> task.apply_async(args, kwargs, task_id="...")
8.7.5 Can I use decorators with tasks?
Answer: Yes. But please see note at Decorating tasks.
140
Chapter 8. Frequently Asked Questions