Working with tasks and task sets.
Discard all waiting tasks.
This will ignore all tasks waiting for execution, and they will be deleted from the messaging server.
Returns: | the number of tasks discarded. |
---|---|
Return type: | int |
Distribute processing of the arguments and collect the results.
Example
>>> from celery.task import map
>>> import operator
>>> dmap(operator.add, [[2, 2], [4, 4], [8, 8]])
[4, 8, 16]
Distribute processing of the arguments and collect the results asynchronously.
Returns: | celery.result.AsyncResult object. |
---|
Example
>>> from celery.task import dmap_async
>>> import operator
>>> presult = dmap_async(operator.add, [[2, 2], [4, 4], [8, 8]])
>>> presult
<AsyncResult: 373550e8-b9a0-4666-bc61-ace01fa4f91d>
>>> presult.status
'DONE'
>>> presult.result
[4, 8, 16]
Execute arbitrary function/object remotely.
Parameters: |
|
---|
The object must be picklable, so you can’t use lambdas or functions defined in the REPL (the objects must have an associated module).
Returns: | class:celery.result.AsyncResult. |
---|
Returns True if task with task_id has been executed.
Return type: | bool |
---|
Test if the server is alive.
Example:
>>> from celery.task import ping
>>> ping()
'pong'