I want to run a Django - Celery task with manual transaction management, but it seems that annotations are not stacking.
eg.
def ping():
print 'ping'
pong.delay('arg')
@task(ignore_result=True)
@transaction.commit_manually()
def pong(arg):
print 'pong: %s' % arg
transaction.rollback()
leads to
TypeError: pong() got an unexpected keyword argument 'task_name'
while the reverse order of annotation leads to
---> 22 pong.delay('arg')
AttributeError: 'function' object has no attribute 'delay'
It makes sense, but it's hard for me to find a good workaround. Django docs don't mention alternate annotations, and I don't want to create a class for every Celery task when I don't need it.
Any ideas?
source
share