This document describes Celery 3.0. For development docs, go here.
Migration tools.
Find tasks by filtering them and move the tasks to a new queue.
| Parameters: |
|
|---|
Also supports the same keyword arguments as start_filter().
To demonstrate, the move_task_by_id() operation can be implemented like this:
def is_wanted_task(body, message):
if body['id'] == wanted_id:
return Queue('foo', exchange=Exchange('foo'),
routing_key='foo')
move(is_wanted_task)
or with a transform:
def transform(value):
if isinstance(value, basestring):
return Queue(value, Exchange(value), value)
return value
move(is_wanted_task, transform=transform)
The predicate may also return a tuple of (exchange, routing_key) to specify the destination to where the task should be moved, or a Queue instance. Any other true value means that the task will be moved to the default exchange/routing_key.
Moves tasks by matching from a task_id: queue mapping, where queue is a queue to move the task to.
Example:
>>> reroute_idmap({
... '5bee6e82-f4ac-468e-bd3d-13e8600250bc': Queue(...),
... 'ada8652d-aef3-466b-abd2-becdaf1b82b3': Queue(...),
... '3a2b140d-7db1-41ba-ac90-c36a0ef4ab1f': Queue(...)},
... queues=['hipri'])
Moves tasks by matching from a task_name: queue mapping, where queue is the queue to move the task to.
Example:
>>> reroute_idmap({
... 'tasks.add': Queue(...),
... 'tasks.mul': Queue(...),
... })
Find a task by id and move it to another queue.
| Parameters: |
|
|---|
Also supports the same keyword arguments as move().