|
@@ -19,7 +19,7 @@ and creating Celery applications.
|
|
|
:class:`group` group tasks together
|
|
|
:class:`chain` chain tasks together
|
|
|
:class:`chord` chords enable callbacks for groups
|
|
|
-:class:`subtask` task signatures
|
|
|
+:class:`signature` object describing a task invocation
|
|
|
:data:`current_app` proxy to the current application instance
|
|
|
:data:`current_task` proxy to the currently executing task
|
|
|
===================== ===================================================
|
|
@@ -131,6 +131,11 @@ and creating Celery applications.
|
|
|
with app.connection() as conn:
|
|
|
pass
|
|
|
|
|
|
+ .. method:: Celery.signature
|
|
|
+
|
|
|
+ Return a new :class:`~celery.canvas.Signature` bound to this app.
|
|
|
+ See :meth:`~celery.signature`
|
|
|
+
|
|
|
.. method:: Celery.bugreport
|
|
|
|
|
|
Return a string with information useful for the Celery core
|
|
@@ -424,14 +429,14 @@ See :ref:`guide-canvas` for more about creating task workflows.
|
|
|
The body is applied with the return values of all the header
|
|
|
tasks as a list.
|
|
|
|
|
|
-.. class:: subtask(task=None, args=(), kwargs={}, options={})
|
|
|
+.. class:: signature(task=None, args=(), kwargs={}, options={})
|
|
|
|
|
|
Describes the arguments and execution options for a single task invocation.
|
|
|
|
|
|
Used as the parts in a :class:`group` or to safely pass
|
|
|
tasks around as callbacks.
|
|
|
|
|
|
- Subtasks can also be created from tasks::
|
|
|
+ Signatures can also be created from tasks::
|
|
|
|
|
|
>>> add.subtask(args=(), kwargs={}, options={})
|
|
|
|
|
@@ -448,15 +453,19 @@ See :ref:`guide-canvas` for more about creating task workflows.
|
|
|
arguments will be ignored and the values in the dict will be used
|
|
|
instead.
|
|
|
|
|
|
- >>> s = subtask("tasks.add", args=(2, 2))
|
|
|
- >>> subtask(s)
|
|
|
+ >>> s = signature("tasks.add", args=(2, 2))
|
|
|
+ >>> signature(s)
|
|
|
{"task": "tasks.add", args=(2, 2), kwargs={}, options={}}
|
|
|
|
|
|
- .. method:: subtask.delay(*args, \*\*kwargs)
|
|
|
+ .. method:: signature.__call__(*args \*\*kwargs)
|
|
|
+
|
|
|
+ Call the task directly (in the current process).
|
|
|
+
|
|
|
+ .. method:: signature.delay(*args, \*\*kwargs)
|
|
|
|
|
|
Shortcut to :meth:`apply_async`.
|
|
|
|
|
|
- .. method:: subtask.apply_async(args=(), kwargs={}, ...)
|
|
|
+ .. method:: signature.apply_async(args=(), kwargs={}, ...)
|
|
|
|
|
|
Apply this task asynchronously.
|
|
|
|
|
@@ -467,46 +476,55 @@ See :ref:`guide-canvas` for more about creating task workflows.
|
|
|
|
|
|
See :meth:`~@Task.apply_async`.
|
|
|
|
|
|
- .. method:: subtask.apply(args=(), kwargs={}, ...)
|
|
|
+ .. method:: signature.apply(args=(), kwargs={}, ...)
|
|
|
|
|
|
Same as :meth:`apply_async` but executed the task inline instead
|
|
|
of sending a task message.
|
|
|
|
|
|
- .. method:: subtask.clone(args=(), kwargs={}, ...)
|
|
|
+ .. method:: signature.freeze(_id=None)
|
|
|
+
|
|
|
+ Finalize the signature by adding a concrete task id.
|
|
|
+ The task will not be called and you should not call the signature
|
|
|
+ twice after freezing it as that will result in two task messages
|
|
|
+ using the same task id.
|
|
|
+
|
|
|
+ :returns: :class:`@AsyncResult` instance.
|
|
|
+
|
|
|
+ .. method:: signature.clone(args=(), kwargs={}, ...)
|
|
|
|
|
|
- Return a copy of this subtask.
|
|
|
+ Return a copy of this signature.
|
|
|
|
|
|
:keyword args: Partial args to be prepended to the existing args.
|
|
|
:keyword kwargs: Partial kwargs to be merged with the existing kwargs.
|
|
|
:keyword options: Partial options to be merged with the existing
|
|
|
options.
|
|
|
|
|
|
- .. method:: subtask.replace(args=None, kwargs=None, options=None)
|
|
|
+ .. method:: signature.replace(args=None, kwargs=None, options=None)
|
|
|
|
|
|
- Replace the args, kwargs or options set for this subtask.
|
|
|
+ Replace the args, kwargs or options set for this signature.
|
|
|
These are only replaced if the selected is not :const:`None`.
|
|
|
|
|
|
- .. method:: subtask.link(other_subtask)
|
|
|
+ .. method:: signature.link(other_signature)
|
|
|
|
|
|
Add a callback task to be applied if this task
|
|
|
executes successfully.
|
|
|
|
|
|
- :returns: ``other_subtask`` (to work with :func:`~functools.reduce`).
|
|
|
+ :returns: ``other_signature`` (to work with :func:`~functools.reduce`).
|
|
|
|
|
|
- .. method:: subtask.link_error(other_subtask)
|
|
|
+ .. method:: signature.link_error(other_signature)
|
|
|
|
|
|
Add a callback task to be applied if an error occurs
|
|
|
while executing this task.
|
|
|
|
|
|
- :returns: ``other_subtask`` (to work with :func:`~functools.reduce`)
|
|
|
+ :returns: ``other_signature`` (to work with :func:`~functools.reduce`)
|
|
|
|
|
|
- .. method:: subtask.set(...)
|
|
|
+ .. method:: signature.set(...)
|
|
|
|
|
|
Set arbitrary options (same as ``.options.update(...)``).
|
|
|
|
|
|
This is a chaining method call (i.e. it will return ``self``).
|
|
|
|
|
|
- .. method:: subtask.flatten_links()
|
|
|
+ .. method:: signature.flatten_links()
|
|
|
|
|
|
Gives a recursive list of dependencies (unchain if you will,
|
|
|
but with links intact).
|