python 3.x - Celery handling named argument -


i have celery task this

@app.task(bind=true,max_retries=3, default_retry_delay=1 * 60)   def dotargetprefilter(self,*args,**kwargs ): 

i calling as

args = [none,sourcedns, targetdnlist] kwargs= {'workername':workername,} result = r.dotargetprefilter.apply_async(*args,**kwargs) 

however getting strange error

file "/usr/local/lib/python3.4/dist-packages/celery/app/amqp.py", line 254, in publish_task raise valueerror('task kwargs must dictionary') 

valueerror: task kwargs must dictionary

a small unit test of invocation works fine;

def test_dotargetprefilter(self):      ltecpxx.mrosimpleexecutor import dotargetprefilter     s=[1,2,3]     t=[1,2,2]     workername="ltecpxx.mrosimpleexecutor.simpleprefilter"     args =[none,s,t]     kwargs={'wokername':workername}     dotargetprefilter(*args,**kwargs) 

i have tried sorts of combinaiton , seen apply_async documentation. works if make normal method (without *args , **kwargs); doing wrong

the bind annotation supplies self; need remove args list, , arguments must in tuple when call apply_async. changing these 2 give

args = [sourcedns, targetdnlist] kwargs= {'workername':workername} result = r.dotargetprefilter.apply_async((args),kwargs) 

and function signature

@app.task(bind=true,max_retries=3, default_retry_delay=1 * 60)  # retry in 1 minutes. def dotargetprefilter(self,*args,workername=""): 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -