Take the 2-minute tour ×

These are my tasks:

@task(name = 'hello')
def hello():
    print "hello"
    return "helo"

@task(name = 'hey')
def hey(resp):
    print resp

I'm calling them like this: g = celery.chain(hello.s(),hey.s()) But I want it to be done like this: hello task should return a value to not only to the task "hey" it should also a return a value back. By that I mean, I should be able to get the return value of "hello" once it is done executing. How to do it?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

The result instance returned when you call a chain will be for the last task in the chain, but it will keep a reference back to the parent, so you can traverse the parents to get the first task:

r = chain(hello.s(), hey.s())()


first = r
while first.parent:
    first = first.parent

See http://docs.celeryproject.org/en/latest/userguide/canvas.html#chains

share|improve this answer

Your Answer


