|
@@ -390,11 +390,12 @@ class Task(object):
|
|
|
:keyword retry: If enabled sending of the task message will be retried
|
|
|
in the event of connection loss or failure. Default
|
|
|
is taken from the :setting:`CELERY_TASK_PUBLISH_RETRY`
|
|
|
- setting. Note you need to handle the
|
|
|
+ setting. Note that you need to handle the
|
|
|
producer/connection manually for this to work.
|
|
|
|
|
|
:keyword retry_policy: Override the retry policy used. See the
|
|
|
- :setting:`CELERY_TASK_PUBLISH_RETRY` setting.
|
|
|
+ :setting:`CELERY_TASK_PUBLISH_RETRY_POLICY`
|
|
|
+ setting.
|
|
|
|
|
|
:keyword routing_key: Custom routing key used to route the task to a
|
|
|
worker server. If in combination with a
|
|
@@ -544,14 +545,14 @@ class Task(object):
|
|
|
>>> from imaginary_twitter_lib import Twitter
|
|
|
>>> from proj.celery import app
|
|
|
|
|
|
- >>> @app.task()
|
|
|
- ... def tweet(auth, message):
|
|
|
+ >>> @app.task(bind=True)
|
|
|
+ ... def tweet(self, auth, message):
|
|
|
... twitter = Twitter(oauth=auth)
|
|
|
... try:
|
|
|
... twitter.post_status_update(message)
|
|
|
... except twitter.FailWhale as exc:
|
|
|
... # Retry in 5 minutes.
|
|
|
- ... raise tweet.retry(countdown=60 * 5, exc=exc)
|
|
|
+ ... raise self.retry(countdown=60 * 5, exc=exc)
|
|
|
|
|
|
Although the task will never return above as `retry` raises an
|
|
|
exception to notify the worker, we use `raise` in front of the retry
|
|
@@ -818,9 +819,8 @@ class Task(object):
|
|
|
:param status: Current task state.
|
|
|
:param retval: Task return value/exception.
|
|
|
:param task_id: Unique id of the task.
|
|
|
- :param args: Original arguments for the task that failed.
|
|
|
- :param kwargs: Original keyword arguments for the task
|
|
|
- that failed.
|
|
|
+ :param args: Original arguments for the task.
|
|
|
+ :param kwargs: Original keyword arguments for the task.
|
|
|
|
|
|
:keyword einfo: :class:`~billiard.einfo.ExceptionInfo`
|
|
|
instance, containing the traceback (if any).
|