你正在阅读 Celery 3.1 的文档。开发版本文档见: 此处.
Task results/state and groups of results.
Base class for all results
Parent result (if part of a chain)
Query task state.
参数: |
---|
Error raised for timeouts.
The task result backend to use.
Iterator, like get() will wait for the task to complete, but will also follow AsyncResult and ResultSet returned by the task, yielding for each result in the tree.
An example would be having the following tasks:
@task()
def A(how_many):
return group(B.s(i) for i in range(how_many))
@task()
def B(i):
return pow2.delay(i)
@task()
def pow2(i):
return i ** 2
Calling collect() would return:
>>> from proj.tasks import A
>>> result = A.delay(10)
>>> list(result.collect())
[0, 1, 4, 9, 16, 25, 36, 49, 64, 81]
Wait until task is ready, and return its result.
警告
Waiting for tasks within a task may lead to deadlocks. Please read Avoid launching synchronous subtasks.
参数: |
|
---|---|
引发 celery.exceptions.TimeoutError: | |
if timeout is not None and the result does not arrive within timeout seconds. |
If the remote call raised an exception then that exception will be re-raised.
The task’s UUID.
When the task has been executed, this contains the return value. If the task raised an exception, this will be the exception instance.
Returns True if the task has been executed.
If the task is still running, pending, or is waiting for retry then False is returned.
When the task has been executed, this contains the return value. If the task raised an exception, this will be the exception instance.
Send revoke signal to all workers.
Any worker receiving the task, or having reserved the task, must ignore it.
参数: |
|
---|
The tasks current state.
Possible values includes:
PENDING
The task is waiting for execution.STARTED
The task has been started.RETRY
The task is to be retried, possibly because of failure.FAILURE
The task raised an exception, or has exceeded the retry limit. The result attribute then contains the exception raised by the task.SUCCESS
The task executed successfully. The result attribute then contains the tasks return value.
The tasks current state.
Possible values includes:
PENDING
The task is waiting for execution.STARTED
The task has been started.RETRY
The task is to be retried, possibly because of failure.FAILURE
The task raised an exception, or has exceeded the retry limit. The result attribute then contains the exception raised by the task.SUCCESS
The task executed successfully. The result attribute then contains the tasks return value.
Wait until task is ready, and return its result.
警告
Waiting for tasks within a task may lead to deadlocks. Please read Avoid launching synchronous subtasks.
参数: |
|
---|---|
引发 celery.exceptions.TimeoutError: | |
if timeout is not None and the result does not arrive within timeout seconds. |
If the remote call raised an exception then that exception will be re-raised.
Working with more than one result.
参数: | results – List of result instances. |
---|
Add AsyncResult as a new member of the set.
Does nothing if the result is already a member.
Remove result from the set if it is a member.
If it is not a member, do nothing.
Did any of the tasks fail?
返回: | True if one of the tasks failed. (i.e., raised an exception) |
---|
See join()
This is here for API compatibility with AsyncResult, in addition it uses join_native() if available for the current result backend.
Backend optimized version of iterate().
2.2 新版功能.
Note that this does not support collecting the results for different task types using different backends.
This is currently only supported by the amqp, Redis and cache result backends.
Iterate over the return values of the tasks as they finish one by one.
Raises: | The exception if any of the tasks raised an exception. |
---|
Gathers the results of all tasks as a list in order.
注解
This can be an expensive operation for result store backends that must resort to polling (e.g. database).
You should consider using join_native() if your backend supports it.
警告
Waiting for tasks within a task may lead to deadlocks. Please see Avoid launching synchronous subtasks.
参数: |
|
---|---|
引发 celery.exceptions.TimeoutError: | |
if timeout is not None and the operation takes longer than timeout seconds. |
Backend optimized version of join().
2.2 新版功能.
Note that this does not support collecting the results for different task types using different backends.
This is currently only supported by the amqp, Redis and cache result backends.
Did all of the tasks complete? (either by success of failure).
返回: | True if all of the tasks has been executed. |
---|
Remove result from the set; it must be a member.
引发 KeyError: | if the result is not a member. |
---|
List of results in in the set.
Send revoke signal to all workers for all tasks in the set.
参数: |
|
---|
Like ResultSet, but with an associated id.
This type is returned by group, and the deprecated TaskSet, meth:~celery.task.TaskSet.apply_async method.
It enables inspection of the tasks state and return values as a single entity.
参数: |
|
---|
The UUID of the group.
List/iterator of results in the group
Result that we know has already been executed.
The tasks state.