I am implementing a backend python script that updates the database. It uses threadpool(http://snippets.dzone.com/posts/show/4425#related). Threadpool size is 3. When records are returned, eg. 10 records, 3 threads are created, then the threads update the database, but doesn't seem to do task_done(). Three threads that were created initially, just hangs. I am running FC7 with python2.5.
class ProfileManager(models.Manager): def not_confirmed(): c = connection.cursor() c.execute("select * from profile_profile where status ='waiting confirmation'") return c.fetchall() backend_threaded.py: #! /usr/bin/env python from apps.utils.threadpool import * #Pyhton ThreadPool: http://snippets.dzone.com/posts/show/4425#related from time import sleep import datetime from os import environ environ['DJANGO_SETTINGS_MODULE'] = "settings" from settings import * from apps.profile.models import * pool = Pool(3) @threadpool(pool) def process(i): print 'threadpool %i enter' % i p = Profile.objects.get(id=i) p.status ="sent" p.save() print 'threadpool %i exit' % i def main(): rs = Profile.objects.not_confirmed() print rs for l in rs: process(l[0]) pool.join() if __name__=="__main__": main() --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---