Friday 15 June 2012

python - Celery @task doesn't work with instance methods -


I have a class in which there are ways to decorate with the Selery @ Task:

  Class port: "" "Dossstrings for ports" def __init __ (self,): print 'class has been initialized ...' @ serie Task (filter = task_mailation, name = "port.price") DEF process (self,): Print "I am in the process work method:"   

Called here: < / P>

  p = port () p.process.apply_async   

I also tried: p.process.delay () , Below the same result.

When I run it, I get this error:

[2013-06-22 02: 32: 53,988: error / main process] Work port. Process [77cff07e-4bc5-4e36- 9c4e-b68d7616c74e] Raised exception: type error ('process takes at least 1 argument (0 given'), traceback (most recent call final): file "/ usr /local/lib/python2.7/site-packages/celery/task/trace.py ", line 228, trace_task in R = realwavel = fun (* args, ** quorage) file" / usr / local / lib / python2 Type_rock (* args, ** kwargs) type_rror: process () takes at least 1 argument (0 given) in .7 / site-packages / celery / task / trace.py ", in line 415 < / Code>

This important part is, TypeError: Process

A How can I solve it ??

Some people say that this happens because the celery method uses unbound for the initial object, and some others say that it just works, Do I miss something here?

To use methods as a work from version 3.0 Experimental support.

The document is in celery.contrib.methods , and some such warnings Which you should be aware of:

Used as a reference

No comments:

Post a Comment