Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Tests passing

  • Loading branch information...
commit 4272feb940cb9046c12afd11e4944dd74774658a 1 parent e3418c2
@ask authored
View
2  celery/canvas.py
@@ -36,7 +36,7 @@ def __init__(self, key):
def __get__(self, obj, type=None):
if obj is None:
return type
- return obj[self.key]
+ return obj.get(self.key)
def __set__(self, obj, value):
obj[self.key] = value
View
8 celery/task/trace.py
@@ -70,7 +70,7 @@ def defines_custom_call(task):
class TraceInfo(object):
- __slots__ = ("state", "retval", "tb")
+ __slots__ = ("state", "retval")
def __init__(self, state, retval=None):
self.state = state
@@ -205,13 +205,13 @@ def trace_task(uuid, args, kwargs, request=None):
[subtask(errback).apply_async((uuid, ))
for errback in task_request.errbacks or []]
else:
- task_on_success(retval, uuid, args, kwargs)
+ if publish_result:
+ store_result(uuid, retval, SUCCESS)
# callback tasks must be applied before the result is
# stored, so that result.children is populated.
[subtask(callback).apply_async((retval, ))
for callback in task_request.callbacks or []]
- if publish_result:
- store_result(uuid, retval, SUCCESS)
+ task_on_success(retval, uuid, args, kwargs)
# -* POST *-
if task_request.chord:
View
7 celery/tests/tasks/test_trace.py
@@ -78,13 +78,6 @@ class test_TraceInfo(Case):
class TI(TraceInfo):
__slots__ = TraceInfo.__slots__ + ("__dict__", )
- def test_without_exc_info(self):
- x = TraceInfo(states.SUCCESS)
- self.assertIsNone(x.exc_type)
- self.assertIsNone(x.exc_value)
- self.assertIsNone(x.tb)
- self.assertEqual(x.strtb, '')
-
def test_handle_error_state(self):
x = self.TI(states.FAILURE)
x.handle_failure = Mock()
View
9 celery/tests/utilities/test_compat.py
@@ -2,6 +2,7 @@
import celery
+from celery.app.task import BaseTask
from celery.task.base import Task
from celery.tests.utils import Case
@@ -10,11 +11,11 @@
class test_MagicModule(Case):
def test_class_property_set_without_type(self):
- self.assertTrue(Task.__dict__["app"].__get__(Task()))
+ self.assertTrue(BaseTask.__dict__["app"].__get__(Task()))
def test_class_property_set_on_class(self):
- self.assertIs(Task.__dict__["app"].__set__(None, None),
- Task.__dict__["app"])
+ self.assertIs(BaseTask.__dict__["app"].__set__(None, None),
+ BaseTask.__dict__["app"])
def test_class_property_set(self):
@@ -22,7 +23,7 @@ class X(Task):
pass
app = celery.Celery(set_as_current=False)
- Task.__dict__["app"].__set__(X(), app)
+ BaseTask.__dict__["app"].__set__(X(), app)
self.assertEqual(X.app, app)
def test_dir(self):
View
2  celery/tests/utilities/test_timer2.py
@@ -59,7 +59,7 @@ def on_error(exc_info):
finally:
timer2.mktime = mktime
- _, exc, _ = scratch[0]
+ exc = scratch[0]
self.assertIsInstance(exc, OverflowError)
View
8 docs/getting-started/first-steps-with-celery.rst
@@ -142,12 +142,10 @@ AMQP, MongoDB, Tokyo Tyrant and Redis -- or you can define your own.
For this example we will use the `amqp` result backend, which sends states
as messages. The backend is configured via the :setting:`CELERY_RESULT_BACKEND`
setting or using the ``backend`` argument to :class:`Celery`, in addition individual
-result backends may have additional settings
-you can configure::
+result backends may have additional required or optional settings
+to configure::
- from celery.backends.amqp import AMQPBackend
-
- celery = Celery(backend=AMQPBackend(expires=300))
+ celery = Celery(backend="amqp")
To read more about result backends please see :ref:`task-result-backends`.
View
17 examples/app/myapp.py
@@ -18,8 +18,23 @@
from celery import Celery
+def debug_args(fun):
+ from kombu.utils import reprcall
+
+ def _inner(self, *args, **kwargs):
+ print("CALL: %r" % reprcall(self.name, args, kwargs))
+ return fun(*args, **kwargs)
+ return _inner
+
+
+
celery = Celery("myapp")
-celery.conf.update(BROKER_URL="amqp://guest:guest@localhost:5672//")
+celery.conf.update(
+ BROKER_URL="amqp://guest:guest@localhost:5672//",
+ CELERY_ANNOTATIONS={
+ "myapp.add": {"@__call__": debug_args},
+ },
+)
@celery.task
Please sign in to comment.
Something went wrong with that request. Please try again.