Hi All,

I'm sure this is a very stupid question. But, here we go.

I am using celery / rabbitmq. It's all working great.

Until I try to move more of my code into my asynchronous tasks to be
handled by celery. I think my problem is because my classes are
subclasses of Task... It's confusing me (not a difficult job, I have
to admit...)

Views.py:
-------------

from tasks import FileExtractor

def upload_file(request):
     if request.method == 'POST':
        form = UploadFileForm(request.POST, request.FILES)
        if form.is_valid():
            # do some stuff
            results = process_upload(filepath)
            return render_to_response("processing.html")
    else:
        form = UploadFileForm()
        return render_to_response('upload.html',  { 'form' : form })

def process_upload(datafile):
    return FileExtractor.delay(filepath)


Tasks.py
-------------
from celery.task import Task
from celery.registry import tasks

class FileExtractor(Task):
    SOME_CLASS_VARS = ....

    def run(self, filepath, **kwargs):
          # do stuff with private methods
          results = FileParser.<AARRRRGH>(self, extracted_data)

    # now a bunch of class-internal methods ("_methods")

tasks.register(FileExtractor)

class FileParser(Task):
    def run(self, filepath, **kwargs):
         # do stuff

    # a few more private methods


=============

So, I can't seem to figure out how to create a new instance of the
second class from the first.

(Hence the AARRRGH. I've got no __init__ method!)

What extremely basic point am I missing?

Thankyou

W

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to