Skip to content
Browse files

Regen working on Python 2.5

  • Loading branch information...
1 parent 0fba468 commit 4094ce8a8b2ce449f1dd92494d3be3edf4b76cac @ask committed
Showing with 11 additions and 4 deletions.
  1. +7 −3 celery/app/builtins.py
  2. +1 −1 celery/canvas.py
  3. +3 −0 celery/utils/functional.py
View
10 celery/app/builtins.py
@@ -219,6 +219,8 @@ def run(self, header, body, interval=1, max_retries=None,
opts["chord"] = body
opts["taskset_id"] = setid
r.append(app.AsyncResult(tid))
+ if eager:
+ return header.apply(task_id=setid)
app.backend.on_chord_apply(setid, body,
interval=interval,
max_retries=max_retries,
@@ -238,9 +240,11 @@ def apply_async(self, args=(), kwargs={}, task_id=None, **options):
body_result.parent = parent
return body_result
- def apply(self, args=(), kwargs={}, **options):
+ def apply(self, args=(), kwargs={}, propagate=True, **options):
body = kwargs["body"]
- res = super(Chord, self).apply(args, kwargs, **options)
- return maybe_subtask(body).apply(args=(res.get().join(), ))
+ res = super(Chord, self).apply(args, dict(kwargs, eager=True),
+ **options)
+ return maybe_subtask(body).apply(
+ args=(res.get(propagate=propagate).get().join(), ))
return Chord
View
2 celery/canvas.py
@@ -333,7 +333,7 @@ def __call__(self, body=None, **options):
_chord = self.Chord
self.kwargs["body"] = body or self.kwargs["body"]
if _chord.app.conf.CELERY_ALWAYS_EAGER:
- return _chord.apply((), self.kwargs)
+ return self.apply((), {}, **options)
callback_id = body.options.setdefault("task_id", uuid())
_chord(**self.kwargs)
return _chord.AsyncResult(callback_id)
View
3 celery/utils/functional.py
@@ -256,6 +256,9 @@ def __init__(self, it):
def data(self):
return list(self.__it)
+ def __iter__(self): # needed for Python 2.5
+ return iter(self.data)
+
def regen(it):
if isinstance(it, (list, tuple)):

0 comments on commit 4094ce8

Please sign in to comment.
Something went wrong with that request. Please try again.