Skip to content

Commit

Permalink
Makes sure chain.link_* works like .apply_async(link*=)
Browse files Browse the repository at this point in the history
  • Loading branch information
ask committed May 29, 2014
1 parent 2d7904a commit 3a148b3
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions celery/canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,12 +355,18 @@ def __call__(self, *args, **kwargs):
if self.tasks:
return self.apply_async(args, kwargs)

def apply_async(self, args=(), kwargs={}, group_id=None, chord=None,
task_id=None, link=None, link_error=None,
publisher=None, root_id=None, **options):
def apply_async(self, args=(), kwargs={}, **options):
# python is best at unpacking kwargs, so .run is here to do that.
app = self.app
if app.conf.CELERY_ALWAYS_EAGER:
return self.apply(args, kwargs, **options)
return self.run(args, kwargs, app=app, **(
dict(self.options, **options) if options else self.options))

def run(self, args=(), kwargs={}, group_id=None, chord=None,
task_id=None, link=None, link_error=None,
publisher=None, producer=None, root_id=None, app=None, **options):
app = app or self.app
tasks, results = self.prepare_steps(
args, self.tasks, root_id, link_error,
)
Expand Down Expand Up @@ -443,8 +449,7 @@ def apply(self, args=(), kwargs={}, **options):
last, fargs = None, args
for task in self.tasks:
res = task.clone(fargs).apply(
last and (last.get(), ), **options
)
last and (last.get(), ), **dict(self.options, **options))
res.parent, last, fargs = last, res, None
return last

Expand Down

0 comments on commit 3a148b3

Please sign in to comment.