On May 8, 5:45 pm, skunkwerk <[EMAIL PROTECTED]> wrote: > i'm getting the wrong output for the 'title' attributes for this > data. the queue holds a data structure (item name, position, and list > to store results in). each thread takes in an item name and queries a > database for various attributes. from the debug statements the item > names are being retrieved correctly, but the attributes returned are > those of other items in the queue - not its own item. however, the > model variable is not a global variable... so i'm not sure what's > wrong. > > i've declared a bunch of worker threads (100) and a queue into which > new requests are inserted, like so: > > queue = Queue.Queue(0) > WORKERS=100 > for i in range(WORKERS): > thread = SDBThread(queue) > thread.setDaemon(True) > thread.start() > > the thread: > > class SimpleDBThread ( threading.Thread ): > def __init__ ( self, queue ): > self.__queue = queue > threading.Thread.__init__ ( self ) > def run ( self ): > while 1: > item = self.__queue.get() > if item!=None: > model = domain.get_item(item[0]) > logger.debug('sdbthread item:'+item[0]) > title = model['title'] > scraped = model['scraped'] > logger.debug("sdbthread title:"+title) > > any suggestions? > thanks
I'll base this on terminology: if a model is in a brain (throughout the known universe), and a dollar's a dollar, it may not pay to build a computer out of brains. If man arises as a tool-carrier, we will carry tools, not people. Don't use Python to make people; make money, and not too much. Pick a wage and you might get somewhere. -- http://mail.python.org/mailman/listinfo/python-list