Retrying tasks with Django-Celery – Django/Celery-open source projects celery/celery

I’m having problems retrying tasks, here is what a test task looks like

from celery.decorators import task

@task()
def add(x, y):
    if not x or not y:
        raise Exception("test error")
    return x+y

I cannot find any documentation what-so-ever on how to retry decoarted tasks, all I found was this:

self.retry(x,y, exc=exception, countdown=30)

which doesn’t seem to work with my case as there is not self variable being passed from the method.

Edit:

I’m trying the following now to no avail:

from celery.decorators import task

@task()
def add(x, y):
    if not x or not y:
        try:
            raise Exception("test error")
        except Exception, e:
            add.retry([x, y], exc=e, countdown=30)
    return x+y

I get the following error:

TypeError(“kwargs argument to retries can’t be empty. Task must accept **kwargs, see http://bit.ly/cAx3Bg”,)

Any ideas?