Hi there!

I am trying to run jobs in the background using the following (minimal) 
code:

Under views.py:

def submit(request):
   model = MyModel()
   model.RunInAThread(ReferenceSeparator, MutationSeparator)

Under models.py:

class MyModel(models.Model):
   def RunInAThread(self, ReferenceSeparator, MutationSeparator):
           print 1
           Thread = multiprocessing.Process(target = self.Run, args=(self, 
ReferenceSeparator, MutationSeparator))
           print 2
           Thread.daemon = True
           print 3
           Thread.start()
           print 4

   def Run(self, ReferenceSeparator, MutationSeparator):
           print 5


But I get the error below and it only print 1, 2, 3 and 4, but not 5:

TypeError at /submit
'str' object is not callable
...
Exception Location: /sw/lib/python2.6/multiprocessing/forking.py in 
__init__, line 98
...

I have tried in many different ways (e.g. Daemon = False, without "self" as 
an "args"), but don't really understand why this would not work, unless 
Django doesn't permit multiprocessing (which some people seem to suggest 
online).
Any help will be highly appreciated.

Best wishes,
Pau

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/27f043ea-d59d-42ee-9529-0bf86ade31b0%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to