python - Celery Chord Callback error -


suppose have celery code this:

@celery.task() def a(a):     try:         .......         .......     except exception,e:         raise  @celery.task() def b(b):     try:         .......         .......     except exception,e:         raise  def c(c):     try:         .......         .......     except exception,e:         raise  def final():     callback = c.s()     header = [a.s(something), b.s(something)]     result = chord(header)(callback)     result.get() 

now when try run task final() error c.s() takes 1 argument (2 given) because callback applied return value of each task in header. how can fix task c() runs fine????

you can use immutable tasks make independant tasks , not forward result.

def final():     # c needs argument, note use of shortcut `si`     callback = c.si(something)     header = [a.s(something), b.s(something)]     result = chord(header)(callback)     result.get() 

as side-note, use of except exception e preferred if you're running python 2.6+ or required python 3.x (see here more details).


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -